我正在运行以下查询进行计数并且它一直给我上述错误...
execute immediate
'select count(*) from "'||rec.table_name||'" WHERE "'||rec.column_name||'" LIKE ('''||l_str||''')'
into l_count;
最终结果是0或1,所以我不明白为什么会这么说。
完整的查询是:
SET SERVEROUTPUT ON size 30000;
declare
l_count number := 0;
l_str varchar2(20) := '%WORD%';
begin
for rec in (select table_name, column_name
from user_tab_columns
where data_type in ( 'CLOB', 'VARCHAR', 'VARCHAR2', 'TEXT' )
) loop
execute immediate
'select count(*) from "'||rec.table_name||'" WHERE "'||rec.column_name||'" LIKE ('''||l_str||''')'
into l_count;
if l_count > 0 then
dbms_output.put_line('FOUND!!! - EXECUTE THIS: SELECT * FROM '||rec.table_name||' WHERE '||rec.column_name || ' LIKE'''||l_str||''';');
end if;
end loop;
end;
/
quit;