473,320 Members | 2,048 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,320 software developers and data experts.

SQLDA problem - data type doesnt match

Hello guys,

Pls dont laugh - it is not funny (actually it is, but it is causing me problems)

I have problem with SQLDA data type specification.

I need to create some counted columns, so I decided to write a trigger (or set of triggers - we will see) to count for me automatically.

I added the column where I would like to have results using command:

db2 "ALTER TABLE <table> ADD CPU_COUNTED INTEGER" since I am sure that the columns affected by trigger are in INTEGER format.

then I tried to create trigger:

CREATE TRIGGER PROC_COUNTER
AFTER INSERT ON <table>
FOR EACH ROW
UPDATE <table>
BEGIN
SET CPU_COUNTED =
CASE
WHEN PART_NBR_OF_CP = 0
THEN 'NBR_OF_CP'
WHEN PART_NBR_OF_CP != 0
THEN 'PART_NBR_OF_CP'
END;

... and I have an error:
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0408N A value is not compatible with the data type of its assignment target. Target name is "CPU_COUNTED". LINE NUMBER=2. SQLSTATE=42821

so - I tried to release DESCRIBE SELECT command to check and I think I found the problem:

The table I am creating with "IMPORT ....create into" statement made these columns (taken from describe):

SQLDA Information

sqldaid : SQLDA sqldabc: 8068 sqln: 183 sqld: 183

Column Information

sqltype sqllen sqlname.data sqlname.length
-------------------- ------ ------------------------------ --------------
496 INTEGER 4 NBR_OF_CP 9
496 INTEGER 4 PART_NBR_OF_CP 14
added column:
497 INTEGER 4 CPU_COUNTED 11

Maybe it is caused that the table is originally created and hosted by z/OS (mainframe) and I have Linux Red Hat ... SO - IS THERE ANY WAY HOW TO SPECIFY THE SQLTYPE FOR INTEGER TO HAVE ALL 496?

.... no - still it is not funny :)
Apr 16 '08 #1
2 4050
Dynamic SQL solved the pb ...
May 12 '08 #2
Pramanwulan,
The case statement in the trigger is trying to assign the name of a column as a string to the integer field - lose the quotes and you should be fine.

As for the SQLDA codes: 496 and 497 are both integers, however the 497 is for nullable columns (the default). Add NOT NULL to the column when adding it to the table with the ALTER statement.
May 15 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: dave | last post by:
Hi I m facing strange problem... I have one field char type data length 1.. It has data either 1 or 2 in all the field tht I have checked through enterprise manager. I'm running query "select...
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
0
by: tom | last post by:
I am new to DB2. I do not know how to set the SQLDA variables. I am using SQR through Brio to select a CLOB field from a table. I have read the examples for C programs using prepare from and...
1
by: Rob | last post by:
I'd like to be able to identify IDENTITY columns via the SQLDA. Looking up the DESCRIDE TABLE statement in DB2 OS/390 Ver7.1 SQL Reference doesn't mention that the SQLDA will contain any...
6
by: Brian Henry | last post by:
How would you parse this type of file into an array? "Test","Help, data","hello there, this text has commas","commas seperate data, and in quotes they dont" where the double quotes are the...
4
by: rgparkins | last post by:
Hello I am running out of time with a problem I have running PHP 5.04 and Apache 2.0 and really need help :(. I have a page that stores a variable in session but each time I reload that page the...
9
by: weirdwoolly | last post by:
Hopefully someone will be able to help. I have written a stored procedure in C++ called from a Java test harness to validate the graphic data types in C++ and their use. I have declared the...
10
by: oktayarslan | last post by:
Hi all; I have a problem when inserting an element to a vector. All I want is reading some data from a file and putting them into a vector. But the program is crashing after pushing a data which...
1
by: shorti | last post by:
I am using DB2 UDB V8.2 on AIX. We recently added some VARCHAR fields into our database and I found an issue with how we are reading data when retrieving it into an sqlda structure using dynamic...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.