Author |
Message
|
Bravo |
Posted: Tue Nov 14, 2006 9:16 am Post subject: DB2 insert problem |
|
|
Centurion
Joined: 03 Oct 2005 Posts: 146
|
Hi All,
I'm trying to insert OutputRoot.XML in a table which is coming from flat file. I'm reading the flat file using Fileinput node.
Here is my code..
Code: |
SET charGENRC_DATA_CHAR = CAST(ASBITSTREAM(OutputRoot.XML,437) as CHAR CCSID 437); |
and even tried
Code: |
SET blobMsgData = BITSTREAM(OutputRoot.XML);
SET charGENRC_DATA_CHAR = CAST(blobMsgData AS CHARACTER CCSID 437); |
SQL query
Code: |
PASSTHRU('INSERT INTO Table(GENRC_DATA_CHAR)VALUES?)',charGENRC_DATA_CHAR); |
DB2 insert was successful but GENRC_DATA_CHAR column is empty.
Any suggestion. _________________ Bravo |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Nov 14, 2006 9:50 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Your passthru is either typed wrong or actually wrong.
"INSERT INTO Table(GENR_DATA_CHAR) VALUES(?)".
Also, BITSTREAM is deprecated, so please don't use it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Edde |
Posted: Tue Nov 14, 2006 9:53 am Post subject: Re: DB2 insert problem |
|
|
 Acolyte
Joined: 01 Oct 2006 Posts: 67 Location: Moscow, Russia
|
Try to see in debugger what you have in charGENRC_DATA_CHAR after SET statement.
My assumption is that your code doesn't work as you think
Code: |
SET charGENRC_DATA_CHAR = CAST(ASBITSTREAM(OutputRoot.XML,437) as CHAR CCSID 437); |
ASBITSTREAM(OutputRoot.XML,437)
is equal to
ASBITSTREAM(OutputRoot.XML Encoding 437)
You should use ASBITSTREAM(OutputRoot.XML,,437) or explicit form
ASBITSTREAM(OutputRoot.XML CCSID 437). |
|
Back to top |
|
 |
Bravo |
Posted: Tue Nov 14, 2006 12:06 pm Post subject: |
|
|
Centurion
Joined: 03 Oct 2005 Posts: 146
|
Thanks Jeff and Edde for quick response
PASSTHRU is correct.
Code: |
PASSTHRU('INSERT INTO Table(GENRC_DATA_CHAR)VALUES(?)',charGENRC_DATA_CHAR); |
just missed one bracket..
I am not getting the problem when I tried to insert as a string to the GENRC_DATA_CHAR column
12346ABCDE11.21
but I tried to insert OutputRoot.XML..the column is empty
FYI : GENRC_DATA_CHAR is define as VARCHAR(3000)
Edde,
I tried no luck.. _________________ Bravo |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Nov 14, 2006 12:09 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Do you see data populated in charGENRC_DATA_CHAR in the debugger or a trace of some kind? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Bravo |
Posted: Tue Nov 14, 2006 1:47 pm Post subject: |
|
|
Centurion
Joined: 03 Oct 2005 Posts: 146
|
Yes Jeff..I can see the data in charGENRC_DATA_CHAR. _________________ Bravo |
|
Back to top |
|
 |
|