PL/SQL embedded insert into table that may not exist

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2010-03-17T14:51:39Z Indexed on 2010/03/17 15:11 UTC
Read the original article Hit count: 176

Filed under:
|
|

Hi,

I much prefer using this 'embedded' style inserts in a pl/sql block (opposed to the execute immediate style dynamic sql - where you have to delimit quotes etc).

-- a contrived example
PROCEDURE CreateReport( customer IN VARCHAR2, reportdate IN DATE )
BEGIN

   -- drop table, create table with explicit column list
   CreateReportTableForCustomer;

   INSERT INTO TEMP_TABLE 
   VALUES ( customer, reportdate );
END;
/

The problem here is that oracle checks if 'temp_table' exists and that it has the correct number of colunms and throws a compile error if it doesn't exist.

So I was wondering if theres any way round that?! Essentially I want to use a placeholder for the table name to trick oracle into not checking if the table exists.

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about plsql