Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create a temporary table in stored proc

451947Aug 31 2005 — edited Oct 14 2005
I'm an Oracle newb, so please forgive my ignorance.

Is it possible to create a temporarty table inside of a stored procedure?

I tried the following, but Oracle gives me an error when I try to compile it:

/***********************************************************/
CREATE OR REPLACE PROCEDURE TESTFUNC AS

BEGIN

create global temporary table gtt
(
CIM_PK VARCHAR2 (36),
SGS_CIRCUIT VARCHAR2 (24),
SGS_CIRCUIT_MEMBER VARCHAR2 (12),
POWERFACTOR float,
SUMMERRATING NUMBER (10),
WINTERRATING NUMBER (10),
ASSET_TYPE CHAR (7),
BARCODE VARCHAR2 (0),
NULL_FLD VARCHAR2 (0)
);


END TESTFUNC;
/
/************************************************************/

The error I get is:

PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:

begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 11 2005
Added on Aug 31 2005
47 comments
9,699 views