473,624 Members | 2,119 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQLDA problem - data type doesnt match

16 New Member
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_COUNTE D". 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 4086
Parnamwulan
16 New Member
Dynamic SQL solved the pb ...
May 12 '08 #2
cburnett
57 New Member
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
2088
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 * from table" and fetching all the records and displaying... It display all the data except data from this
6
2907
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 this, and came across a problem that I haven't been able to solve elegantly. The problem is to find "linker" vertexes that a pair of verteces from a pre-defined set. For example, if the graph verteces represent cities and edges represent flights...
0
1721
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 describe into and I do not see how to port this to SQR. So I want to manually set the SQLDA variables. How can I manipulate them? Thanks Tom Broughan
1
1716
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 information about IDENTITY columns. Is this an oversight by IBM? Alternatively, does anyone know of a smart way to find this information other than querying the Catalog?
6
1225
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 string markers, which can contain comma's, but when you are not in a quote block the commas seperate the data... you're basic Comma seperated value file... thanks (i know split doesnt work for this... thats why im asking)
4
2867
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 session seems to be re-created and is an empty array. I have checked the session file and the variable is being stored against the session id, but I dont know why PHP is not picking up the session after I reload.. I have tried the usual suspects...
9
3863
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 vargraphic input parameters along the following lines in i_vargraphic100 vargraphic(100) and they are populated from String's in java.
10
2189
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 has string value. I really do not understand why push_back() function is trying to remove previously inserted data. Thanks for any help
1
4483
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 sql. Here is the issue: This particular table has several VARCHAR(256) fields. I set up a few records that spanned all 256 char bytes then ran the debugger. I found that I am only receiving the first 254 bytes of data in sqlda- for the...
0
8234
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
8172
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
8677
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...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4079
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...
1
2605
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
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.