Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Dinamic PL/SQL.
Maria,
The basic idea is something like this:
CREATE OR REPLACE PROCEDURE MakeTable( pTableName IN VARCHAR) AS
hCursor INTEGER; rows INTEGER; BEGIN hCursor := dbms_sql.open_cursor; dbms_sql.parse( hCursor, 'CREATE TABLE ' || pTableName || 'col1 NUMBER(1) )', dbms_sql.v7); ---------------------------------------------------------------- -- For Non-DDL ops, you need to explicitely execute the cursor -- like this: -- rows := dbms_sql.execute( hCursor ) -- You don't need to do this for DDL such as CREATE TABLE ---------------------------------------------------------------- dbms_sql.close_cursor(hCursor);END; Remember not to put a semicolon (";") at the end of you statement in the dbms_sql.parse call -- I think everybody makes this mistake at least once.
HTH.
Regards,
Charles_Dye_at_corp.dialog.com
> From owner-oracle-l_at_CCVM.SUNYSB.EDU Tue Mar 5 04:49:35 1996
> Date: Mon, 4 Mar 1996 07:47:34 -0500
> From: Maria del Pilar Villamil Giraldo <m-villam_at_UNIANDES.EDU.CO>
> Subject: Dinamic PL/SQL.
> X-To: "ORACLE database mailing list." <ORACLE-L_at_ccvm.sunysb.edu>
> To: Multiple recipients of list ORACLE-L <ORACLE-L_at_ccvm.sunysb.edu>
>
> Hi,
> I can execute using Dinamic PL/SQL. commands how:
> Create Table????
> in general commands of DDL??
>
> if I can, how is the process to this???
>
> Thank you
>
Received on Mon Mar 04 1996 - 12:12:27 CST
![]() |
![]() |