Hi
I m new to DB2..
I am using DB2 version8. I have a few queries (which i create
dynamically) stored in a table. The column which stores them is clob
32k. Each of these query has a ":wf_id" string in 2 places, which i
replace with another string (using the replace function in sysfun pkg
in db2) before executing them. its something like:
DECLARE sqlString VARCHAR(32000);
For i as select dataValue from test_table
do
SET sqlString = SYSFUN.REPLACE( i.dataValue, ':wf_id', 'abcdef');
-- PREPARE STMT from sqlString;
EXECUTE IMMEDIATE strSql;
END FOR;
I get errors with this replace function... i guess, it does not work
fine with CLOBs in version 8 of DB2. Is there some work around other
than changing my column type to varchar(32000).
I have tried cast function also as in :
For i as select cast(dataValue as VARCHAR(32000)) dataValueChar from
test_table
The error in this case is that the query that comes in i.dataValueChar
is too long... this again happens with replace function. If i dont
replace and just assign it to sqlString, all works fine.. something
like:
SET sqlString = i.dataValue;
Can someone please help me with this problem... or is there some other
way to run dynamic parameterized queries in db2 (with clob as a column
type).
Thanks in advance
I m new to DB2..
I am using DB2 version8. I have a few queries (which i create
dynamically) stored in a table. The column which stores them is clob
32k. Each of these query has a ":wf_id" string in 2 places, which i
replace with another string (using the replace function in sysfun pkg
in db2) before executing them. its something like:
DECLARE sqlString VARCHAR(32000);
For i as select dataValue from test_table
do
SET sqlString = SYSFUN.REPLACE( i.dataValue, ':wf_id', 'abcdef');
-- PREPARE STMT from sqlString;
EXECUTE IMMEDIATE strSql;
END FOR;
I get errors with this replace function... i guess, it does not work
fine with CLOBs in version 8 of DB2. Is there some work around other
than changing my column type to varchar(32000).
I have tried cast function also as in :
For i as select cast(dataValue as VARCHAR(32000)) dataValueChar from
test_table
The error in this case is that the query that comes in i.dataValueChar
is too long... this again happens with replace function. If i dont
replace and just assign it to sqlString, all works fine.. something
like:
SET sqlString = i.dataValue;
Can someone please help me with this problem... or is there some other
way to run dynamic parameterized queries in db2 (with clob as a column
type).
Thanks in advance
Comment