Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: variables in pl/sql
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
![]() |
![]() |