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: Help! Question on PL/SQL

Re: Help! Question on PL/SQL

From: Uwe Uhlemann <uhlemann_at_gmx.de>
Date: Fri, 21 Jan 2000 14:30:13 +0100
Message-ID: <869n0e$2fdh4$1@fu-berlin.de>

"Dana Jian" <djian_at_trasa.com> schrieb im Newsbeitrag news:3887953d$0$6125_at_news.choice.net...
> Thanks for the help!
>
> Can I put the "create table temp1 as select .... from .... where ....."
into
> a stored procedure/function on the server??
> I got the error when I was trying to do this:
>
> PLS-00103: Encountered the symbol "CREATE" when expecting one of the
> following:
>
> begin declare end exception exit for goto if loop mod null
> pragma raise return select update while <an identifier
>
> Any idea/help will be greatly appreciated!!

Yes.
You can't make CREATE in PL/SQL direct. Use the Package DBMS_SQL.

Exemple:

<<create_table_test>>
DECLARE
 anzahl number;
 v_cursor number;
 v_create varchar2(200);
begin

 v_cursor := sys.dbms_sql.open_cursor;
 v_create := 'create table test (c1 date not null,c2 varchar(30),c3 varcharchar(80))';
 sys.dbms_sql.parse(v_cursor,v_create, sys.dbms_sql.V7);  anzahl := sys.dbms_sql.execute(v_cursor);  sys.dbms_sql.close_cursor(v_cursor);

end if;
 exception
 when OTHERS then raise_Application_error(sqlcode,sqlerrm,true);

end create_table_test;
/



Dipl.-Wirt. Ing.
Uwe Uhlemann
SPM - Systementwicklung und Projektmanagement GmbH An den Treptowers 1
12435 Berlin, Germany
Tel +49 (30) 55115-365, Fax -100
uuhlemann@spm.de http://www.spm.de Received on Fri Jan 21 2000 - 07:30:13 CST

Original text of this message

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