Cannot 'TRUNCATE TABLE <table_name>' within LOOP (Error ORA-06550)
12738Nov 6 2006 — edited Nov 6 2006The below code generates the following error:
ORA-06550: line 26, column 14:
PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:
:= . ( @ % ;
The symbol ":= was inserted before "TABLE" to continue.
LOOP
FETCH sat_cursor
INTO sat_data;
EXIT when sat_cursor%NOTFOUND;
dbms_output.put_line(sat_data.table_name);
v_TBLNAME := sat_data.table_name;
TRUNCATE TABLE v_TBLNAME;
END LOOP;
The truncate by itself works "TRUNCATE table cucodes"
Thanks.