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: Mark D Powell <Mark.Powell_at_eds.com>
Date: 16 May 2007 08:31:28 -0700
Message-ID: <1179329488.699621.98620@h2g2000hsg.googlegroups.com>


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

Original text of this message

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