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!

tick marks in dynamic sql driving me crazy

user34836Jul 2 2009 — edited Jul 2 2009
Good Morning,

I am trying to write a simple statement and am dumb founded at how irritating a tick mark can be. I have read the documentation on how to write it but some of it is not clear regarding the tick marks.

declare cursor c1 is
select * from dba_tab_columns
where column_name ='CURRENT_STATE'
and owner not in ('SYSTEM','SYS','REPADMIN','SYSMAN');

cnt_var number;

for c1_rec in c1 loop

execute immediate 'select count(*) into cnt_var
from '||c1_rec.owner||'.'||c1_rec.table_name||
' where '||c1_rec.column_name|| '=PUBLISHED';

dbms_output.put_line(c1_rec.table_name||' '||cnt_var);

end loop;

end;
/

For some reason it doesn't like the following line:

' where '||c1_rec.column_name|| '=PUBLISHED';


Right now my eyes have glazed over staring at this thing and maybe someone out there looking at this would be able to see
the error.

Also I would like to request if anyone can recommend a book for dummies on dynamics sql statements. It would be appreciated.

Thanks for your help in this matter in advanced.

regards,

al
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 30 2009
Added on Jul 2 2009
14 comments
3,693 views