为什么我总是收到以下错误?
Fehlerbericht: ORA-00933: SQL-Befehl wurde nicht korrekt beendet
ORA-06512: in Zeile 13
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:
我的代码:
DECLARE
match_count INTEGER;
v_owner VARCHAR2(255) :='XXX';
v_data_type VARCHAR2(255) :='CHAR';
sqlstr varchar(255) := '';
BEGIN
FOR t IN (SELECT owner, table_name, column_name FROM all_tab_cols where owner=v_owner and data_type = v_data_type and column_name = 'TEST') LOOP
match_count:=0;
if length(t.table_name) > 0 then
sqlstr := 'SELECT COUNT(*) FROM ' || t.table_name || ' WHERE TEST<> ''000''';
EXECUTE IMMEDIATE sqlstr into match_count;
end if;
IF match_count > 0 THEN
execute immediate 'insert into search_db_results values (' || '''' || t.table_name || '''' || ',' || '''' || match_count || '''' || ')';
END IF;
END LOOP;
END;