Author |
Message
|
MAN1SH |
Posted: Tue Jul 19, 2011 2:05 am Post subject: Extracting Nullable Fields from the Database |
|
|
Newbie
Joined: 03 May 2011 Posts: 8
|
Hi,
I am extracting the nullable fields from the database and then mapping it to the target Message Set.
if the field has Null value then the element to which i am mapping that field is not getting generated.
I just wanted to know if we can use COALESCE in the query if it is returning multiple columns,
if yes can anyone please tell me the syntax of it. |
|
Back to top |
|
|
mqsiuser |
Posted: Tue Jul 19, 2011 2:29 am Post subject: |
|
|
Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Make your SELECT on the DB...
Then later you map the data into your message structure:
1. If you map NULL then the field will not get generated (except --> look at "3." below)
2. If you do "OutputRoot.myStructure.myField = COALESCE( dbValue, '');" then an empty element gets generated "<myField ></myField >
3. Define a Schema (an xsd-file) and define the element as nillable. Use the Schema when parsing out the message. nillable means "<myField/>".
e.g. <xsd:element name="myField" type="xsd:string" nillable="true"/>
I am not sure if "OutputRoot.myStructure.myField" needs to be set to "NULL" or to the empty string ('') to make the out-parsing (with the xsd) generate a NIL-element ("<myField/>"), so please try this out.
Using coalesce within the select itself... hmmm |
|
Back to top |
|
|
fjb_saper |
Posted: Tue Jul 19, 2011 12:42 pm Post subject: |
|
|
Grand High Poobah
Joined: 18 Nov 2003 Posts: 20729 Location: LI,NY
|
Depends which parser you are using...
With the MRM parser using SET myfield VALUE = NULL;
and the correct policy for null fields on the message set will generate the xsi:nil="true" attribute for your null field.
With the other parsers you will have to create the attribute AFAIK.
Have fun _________________ MQ & Broker admin |
|
Back to top |
|
|
mqsiuser |
Posted: Tue Jul 19, 2011 11:33 pm Post subject: |
|
|
Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
Hello,
you posted into the forum "WebSphere MQ Workflow & Business Process Choreographer", but your question sounds like a Broker question. The forum for Broker is "WebSphere Message Broker Support". Do you use Message Broker?
In Broker COALESCE within the ESQL SELECT is not possible.
Thought... you can use PASSTHRU(" --- native (e.g. ORACLE) Select-Statement --- "). Likely you can do more there (depends on the SQL-statements that the DB supports). |
|
Back to top |
|
|
Vitor |
Posted: Wed Jul 20, 2011 4:02 am Post subject: |
|
|
Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqsiuser wrote: |
you posted into the forum "WebSphere MQ Workflow & Business Process Choreographer", but your question sounds like a Broker question. |
Moved on the assumption this is about broker _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
|
MAN1SH |
Posted: Fri Jul 22, 2011 10:00 pm Post subject: |
|
|
Newbie
Joined: 03 May 2011 Posts: 8
|
Thank you all for ur response |
|
Back to top |
|
|
|