tick marks in dynamic sql driving me crazy
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