Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Error in a very simple Function
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 DBAReceived on Wed May 16 2007 - 10:22:28 CDT