Hi,
I'm struggling to execute a dynamic SQL command. I wrote a small SQL command for testing purposes, which works in ACS:
If I wrap the command in a EXECUTE IMMEDIATE, it fails with the SQLSTATE 42612 and SQLCODE -84. First I thought it might be the explicit naming of the library so I changed SESSION to QTEMP which gives the same error (as it should). Removing the library name also doesn't work and results in the same error. They all fail:
Then I thought that you maybe can't execute a DECLARE GLOBAL TEMPORARY TABLE command in a EXECUTE IMMEDIATE command, but according to the documentation it should work:
Am I missing something?
Thanks in advance
I'm struggling to execute a dynamic SQL command. I wrote a small SQL command for testing purposes, which works in ACS:
Code:
DECLARE GLOBAL TEMPORARY TABLE SESSION.T1 (C1 VARCHAR(10));
Code:
EXECUTE IMMEDIATE 'DECLARE GLOBAL TEMPORARY TABLE SESSION.T1 (C1 VARCHAR(10))'; EXECUTE IMMEDIATE 'DECLARE GLOBAL TEMPORARY TABLE QTEMP.T1 (C1 VARCHAR(10))'; EXECUTE IMMEDIATE 'DECLARE GLOBAL TEMPORARY TABLE T1 (C1 VARCHAR(10))';
Am I missing something?
Thanks in advance
Comment