Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help! Question on PL/SQL
"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;
/
![]() |
![]() |