I created an Oracle stored procedure to delete some backup tables. The script will fail on line 5, and I can not figure out why. The error message thinks that str is a stored procedure. Can anyone see what the issue might be here?
1 declare str varchar2(200);
2 begin for rec in (select table_name from all_tables where table_name like '%INFO_BAK_%')
4 str := 'drop table ' || rec.table_name;
5 execute immediate str;
6 end loop;