Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: variables in pl/sql

Re: variables in pl/sql

From: Peter Laursen <ptl_at_edbgruppen.dk>
Date: 25 Nov 1999 11:33:33 GMT
Message-ID: <01bf3741$46a825d0$2c289a0a@apollo>


tomjnsn_at_my-deja.com skrev i artiklen <81hg9f$aa7$1_at_nnrp1.deja.com>...
> I'm having problems understanding how to create a new table with a name
> that isn't known until the procedure is called. I've tried putting the
> variable name in the create statement, but it just names the table the
> variable name not the value of the variable. Using 8.0.5 standard. Any
> suggestions?

This procedure does it. Needs explicit grant create table to the procedure owner.

procedure NewTable(TABLE_NAME in varchar2) as   dummy INTEGER;
  ddl varchar2(2000);
begin
  dummy := DBMS_SQL.OPEN_CURSOR;
  ddl := 'create table '||TABLE_NAME||' (a int)';   DBMS_SQL.PARSE(dummy, ddl, DBMS_SQL.Native); end;

Peter Laursen Received on Thu Nov 25 1999 - 05:33:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US