Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Temporary Table Error

Status
Not open for further replies.

GilMerc

IS-IT--Management
Nov 12, 2003
115
CA
Hi,

I have a problem to define the global temporary table into my UDF (DB2 v8.1).
Somebody can help on this.
Here's the code and the error :
_________________________________________________
CREATE FUNCTION MySchema.GM_FCT (ID INTEGER)
RETURNS TABLE
( ID INTEGER,
NO INTEGER,
NAME VARCHAR(50),
ID_GROUP INTEGER,
AUTORIZATION CHAR(1)
)
LANGUAGE SQL
NO EXTERNAL ACTION
DETERMINISTIC
BEGIN ATOMIC
DECLARE PrevCount INTEGER;
DECLARE Count INTEGER;

DECLARE GLOBAL TEMPORARY TABLE List
(ID INTEGER,
IDGROUP INTEGER,
AUTHORIZATION CHAR(1))
WITH REPLACE;

SET PrevCount = 0;
SET Count = 0;
RETURN
SELECT 1, 2, 'MON', CAST(NULL AS INTEGER), '1' FROM SYSIBM.SYSDUMMY1;
END
GO

>[Error] Script lines: 1-28 -------------------------
DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: TABLE session.ListeEtudeAutor
(ID ;ARE GLOBAL TEMPORARY;<space>
Message: An unexpected token "TABLE session.ListeEtudeAutor
(ID " was found following "ARE GLOBAL TEMPORARY". Expected tokens may include: "<space>".
Line: 17 
________________________________________________________

Gilles.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top