Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Execute immediate using like operator

551142Feb 15 2008 — edited Feb 15 2008
declare
v_object_name varchar2(2000);
sql_stmt varchar2(2000);
cursor cu_get_old_table_name is
Select object_name
from t_tables_to_be_dropped;
begin
for cur in cu_get_old_table_name
LOOP
sql_stmt := 'Select object_name from user_source where text like %'||cur.object_name ||'%';

execute immediate sql_stmt;

END LOOP;

END;
1. I want to use a like operator in my SQL_STMT, which is going to be used for execute immediate later. How can a like operator be used in dynamic sql?
2. This block is erroring out. I am trying to get a list of objects that use the old table name, and that could be more than one object per table name. so i would need the logic for looping in execute immediate.
Any help appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2008
Added on Feb 15 2008
7 comments
1,604 views