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, 10:20 am, 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 ??
PL/SQL does not directly support any DDL statements. CREATE VIEW is a DDL statement. Look up the EXECUTE IMMEDIATE statement in the PL/SQL Users Guide and Reference or use the DBMS_SQL package to issue the DDL. Also there is no valid reason to create tables or indexes on the fly in a function. Views are permanent objects that can be directly queried so your entire function seems to server no valid purpose.
HTH -- Mark D Powell -- Received on Wed May 16 2007 - 10:31:28 CDT
![]() |
![]() |