Skip to content
Advertisement

Oracle Cursor within a Package not working – ORA 06512

I am trying to build a package that will take in a table of table names and either drop from or delete those tables. I am using dynamic sql, and dropping or deleting the tables works, but I need both the procedures to loop through all of the table names passed back to it.

I’ve tried mulitple ways – including trying to create a FOR Loop and a cursor. Here is a similar function I wrote in PostgreSQL that works but I’m having trouble translating it to Oracle.

Here is my function in PostgreSQL that works:

And the procedure I’m writing as part of a package in Oracle

Here is the error I get when I try to call my function: Error report – ORA-00903: invalid table name ORA-06512: at “AMS_NYS.STND_BUILD_TABLE_CLEANUP”, line 13 ORA-06512: at line 2 00903. 00000 – “invalid table name” *Cause:
*Action:

Thanks!

Advertisement

Answer

Here’s one possibility. Note that I coded this as a standalone procedure for simplicity.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement