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: <pbolduc_at_my-deja.com>
Date: Fri, 26 Nov 1999 23:23:05 GMT
Message-ID: <81n4on$2kv$1@nnrp1.deja.com>


dont forget to close your cursor!

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);   DBMS_SQL.CLOSE_CURSOR(dummy);
end;

In article <01bf3741$46a825d0$2c289a0a_at_apollo>,   "Peter Laursen" < ptl_at_edbgruppen.dk> wrote:
> 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
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Nov 26 1999 - 17:23:05 CST

Original text of this message

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