473,386 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem with CLOBS

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

May 30 '07 #1
3 7110
am***********@gmail.com wrote:
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).
Why? REPLACE does support CLOBs:
http://publib.boulder.ibm.com/infoce...n/r0000843.htm

$ db2 "values replace(clob('abcdef', 32000), 'cd', 'xy')"

1
-----------
abxyef

1 record(s) selected.
So what exactly is the error that you got?
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.
What exactly is the error message that you got?
If i dont
replace and just assign it to sqlString, all works fine.. something
like:
SET sqlString = i.dataValue;
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
May 30 '07 #2
I get following error:
SQL0443N Routine "SYSFUN.REPLACE" (specific name "REPLACE2C") has
returned an error SQLSTATE with diagnostic text "SYSFUN:10"


On May 30, 1:33 pm, Knut Stolze <sto...@de.ibm.comwrote:
amitabh.me...@gmail.com wrote:
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).

Why? REPLACE does support CLOBs:http://publib.boulder.ibm.com/infoce...ic/com.ibm.db2....

$ db2 "values replace(clob('abcdef', 32000), 'cd', 'xy')"

1
-----------
abxyef

1 record(s) selected.

So what exactly is the error that you got?
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.

What exactly is the error message that you got?
If i dont
replace and just assign it to sqlString, all works fine.. something
like:
SET sqlString = i.dataValue;

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany

May 30 '07 #3
It works fine when the length of the string-part that is to be
reaplaced (arg 2 of replace) is equal or greater than the new string
path (arg 3 of replace). If arg 3 is greater than arg 2 i am getting
this error. (sysfun:10)

On May 30, 1:38 pm, amitabh.me...@gmail.com wrote:
I get following error:
SQL0443N Routine "SYSFUN.REPLACE" (specific name "REPLACE2C") has
returned an error SQLSTATE with diagnostic text "SYSFUN:10"

On May 30, 1:33 pm, Knut Stolze <sto...@de.ibm.comwrote:
amitabh.me...@gmail.com wrote:
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).
Why? REPLACE does support CLOBs:http://publib.boulder.ibm.com/infoce...ic/com.ibm.db2....
$ db2 "values replace(clob('abcdef', 32000), 'cd', 'xy')"
1
-----------
abxyef
1 record(s) selected.
So what exactly is the error that you got?
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.
What exactly is the error message that you got?
If i dont
replace and just assign it to sqlString, all works fine.. something
like:
SET sqlString = i.dataValue;
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany

May 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rachel Pevtzow | last post by:
i currently have a few (non-oracle) databases containing personal papers of wellington, mountbatten, etc. i'm thinking about moving it into oracle, but i'm worried about how to get the data in. ...
117
by: Peter Olcott | last post by:
www.halting-problem.com
0
by: Fred | last post by:
Hello, I found a CLOB column in a DMS table that programmers were using to store tiny strings (less than a couple kilobytes). Since CLOB columns can only allocate entire kilobytes of space at...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
3
by: cpressley2 | last post by:
Hi all, I am doing a db converison from windows v7 to aix v8. The db contains many LOBs. I did an export specifying the LOB option, compressed the data (using tar and gzip for windows) , ftp the...
0
by: Starsky | last post by:
Hello everyone! I am spanish and I am developing an application using DB2 v9 and Java. I´m currently trying new things but I have a problem. I can easily do INSERTS from my application into the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.