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.
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.