Question : Create table statement inside a procedure

Hello,

This is probably a really simple question.  

But I was wondering if I could create a procedure with the following PL/SQL and then call that procedure from a different procedure.

CREATE TABLE compound_list (
  CompoundID      VARCHAR2(10),
  BatchID         VARCHAR2(5)
)
ORGANIZATION EXTERNAL (
  TYPE ORACLE_LOADER
  DEFAULT DIRECTORY ABASE_DIR
  ACCESS PARAMETERS (
    RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    (
  CompoundID,
  BatchID
    )
  )
  LOCATION ('list.txt')
)
PARALLEL 5
REJECT LIMIT UNLIMITED;

Is what I'm asking even possible?  From what I've seen with procedures only DML statements are allowed (UPDATE, SELECT, DELETE).

Thanks

Mike

Answer : Create table statement inside a procedure

PROCEDURE CREATE_TABLE_compound_list
IS
  v_dyn_statement varchar2(4000);
BEGIN
  v_dyn :=  ' your create statement with ' replace by ''  ';
  execute immediate v_dyn;
END;

change the invoker rights of the procedure if you want the calling user of the procedure to be the owner of the table instead of the creating user of the procedure
Random Solutions  
 
programming4us programming4us