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: Error in a very simple Function

Re: Error in a very simple Function

From: sybrandb <sybrandb_at_gmail.com>
Date: 16 May 2007 08:22:28 -0700
Message-ID: <1179328948.780415.195070@p77g2000hsh.googlegroups.com>


On May 16, 4:20 pm, Claudiodom <cla..._at_gmail.com> wrote:
> FUNCTION CriaTabela RETURN VARCHAR IS
> BEGIN
> CREATE VIEW T_LOTCDA_TEMP AS SELECT * FROM T_LOTCDA;
>
> RETURN 'NOTHING';
> END;
>
> This funct its inside a package, and its giving an error near 'CREATE'
> and i'm not understanting witch error should this be...
>
> can someone help me ??

create view is DDL (Data Definition Language). DDL is not allowed in stored procedures and functions, and it is also a bad idea to create views or whatever hidden in a stored procedure or function on the fully. That is, unless you want to be lynched by your DBA or a messy application.
That said, your PL/SQL manual would have taught you, it is possible once you
a) actually read those manuals instead of having others abstract them, and misuse this forum as a free CBT
b) realize you can use EXECUTE IMMEDIATE

Please look up execute immediate in the docs.

--
Sybrand Bakker
Senior Oracle DBA
Received on Wed May 16 2007 - 10:22:28 CDT

Original text of this message

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