473,769 Members | 7,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7164
am***********@g mail.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('a bcdef', 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...@g mail.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('a bcdef', 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...@g mail.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...@g mail.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('a bcdef', 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
518
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. the limit on character fields in the current database system is 65000 characters, and we've run into that a number of times. i've used sqloader to get data into oracle databases in the past, but i've never worked with clobs before. i can output...
117
7264
by: Peter Olcott | last post by:
www.halting-problem.com
0
1739
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 best (when created with the COMPACT qualifier), I know that this was wasting a lot of space in the long tablespace. I added a VARCHAR(2048) column to that table so it could hold those small strings instead, which allowed me to null out the tiny...
28
5222
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(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I don't know at runtime what the child class is? I'm using Activator.CreateInstance() to load the...
6
3812
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 is more that 1249 bytes, then the progress bar of the browser will move too slow and then displaying that the page not found!!!! If the message is less than or equal to 1249 then no problem.
16
4928
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 Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be easily verified: Implement the following in a web service method (just raises a SOAPException with a...
2
4556
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 set to...it is set to false. Can someone show me what I am doing wrong and tell me the correct way? Thank you. In the page load event, I am doing the following:
3
1548
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 data, and decompressed the data. I then ran the import using the same LOB option and the output from the import command says that the data was loaded with no issues. However when the application tries to view the data, it complains about
0
1678
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 DB (XML, CLOBS, etc.) but I have problems when I execute: String qDesc="SELECT DESCRIPCION FROM AVION"; Statement pst2 = cx.createStatement(); ResultSet...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.