Posted: Mon Nov 25, 2013 11:21 am Post subject: Using REXX and DB2 - Declare Global Temporary Table
I'm getting an error when I attempt the following in REXX. The same statement executes successfully in TSO/SPUFI. What Host Variable is it looking for?
Code:
EXECUTE IMMEDIATE DECLARE GLOBAL TEMPORARY TABLE SESSION.PGMTBL
(PROGNAME CHAR(8) NOT NULL
,SECTNO SMALLINT
,QUERYNO INTEGER
,CONTOKEN CHAR(16) NOT NULL
,SQL_TEXT VARCHAR(3000) NOT NULL
)
CCSID EBCDIC
ON COMMIT PRESERVE ROWS
You cannot execute a SELECT, INSERT, UPDATE, MERGE, or DELETE statement that contains host variables. Instead, you must execute PREPARE on the statement, with parameter markers substituted for the host variables, and then use the host variables in an EXECUTE, OPEN, or FETCH statement.
However I am not executing any of the above mentioned statements, just a DECLARE.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Nov 25, 2013 11:38 am Post subject: Re: Using REXX and DB2 - Declare Global Temporary Table
RoyKMathur wrote:
I'm getting an error when I attempt the following in REXX. The same statement executes successfully in TSO/SPUFI. What Host Variable is it looking for?
Roy,
try this
Code:
SQL_STATEMENT = "DECLARE GLOBAL TEMPORARY TABLE SESSION.PGMTBL",
"(PROGNAME CHAR(8) NOT NULL",
",SECTNO SMALLINT",
",QUERYNO INTEGER",
",CONTOKEN CHAR(16) NOT NULL",
",SQL_TEXT VARCHAR(3000) NOT NULL",
")",
"CCSID EBCDIC".
"ON COMMIT PRESERVE ROWS"
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum