|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
XML to DB2... handling null values |
« View previous topic :: View next topic » |
Author |
Message
|
bpugh |
Posted: Tue Apr 27, 2004 7:17 am Post subject: XML to DB2... handling null values |
|
|
Novice
Joined: 27 Apr 2004 Posts: 24 Location: St. Louis, MO
|
Forgive my ignorance, but I am new to WBIMB. I am trying to receive an XML file and insert the data into a DB2 database on z/OS. All of the fields on my DB2 database are specified as "Not Null", and I am not in a position to change that.
My schema has default values such as the following:
<xsd:element name="title" type="xsd:string" minOccurs="0" default=" "/>
<xsd:element name="first" type="xsd:string" minOccurs="0" default=" "/>
<xsd:element name="mi" type="xsd:string" minOccurs="0" default=" "/>
<xsd:element name="last" type="xsd:string" minOccurs="0" default=" "/>
If I receive a file that looks like this (notice there is no middle initial)
<title>Mr.</title>
<first>John</first>
<last>Doe</last>
my trace nodes show the "mi" field as null, not blank. This causes my database insert to blow up. I know I could take the minOccurs="0" off and require all fields, but that seems like a waste since the schema has many fields and I know that most of them will not be used most of the time.
Any ideas for a rookie on how to force it to see that field as blank, not null? |
|
Back to top |
|
 |
GYR |
Posted: Wed Apr 28, 2004 5:08 am Post subject: |
|
|
Acolyte
Joined: 23 Jan 2002 Posts: 72
|
You don't show how your doing your insert, is it via compute node or via an insert node. i would suggest that you use a compute node and construct the insert using the COALESCE function i.e
insert into Database.schema.table (fielda,fieldb...etc) values(COALESCE('InputBody.*.xxxxxxxx, ' ',.........etc) that way if any of your values come in as null then blank will be used instead which is more amenable to mainframe and iseries DB2 databases.
Just a thought |
|
Back to top |
|
 |
bpugh |
Posted: Wed Apr 28, 2004 5:58 am Post subject: |
|
|
Novice
Joined: 27 Apr 2004 Posts: 24 Location: St. Louis, MO
|
Thanks for the advice. I am using the compute node, so that's an easy change to make. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|