ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to select NULL value from SELECT?

Post new topic  Reply to topic
 How to select NULL value from SELECT? « View previous topic :: View next topic » 
Author Message
et381
PostPosted: Thu Jul 09, 2009 6:04 pm    Post subject: How to select NULL value from SELECT? Reply with quote

Newbie

Joined: 09 Jul 2009
Posts: 3

Hi All,

Got a quick question regarding ESQL

If I want to set a node value to NULL, I could do something like this.

SET OutputRoot.MRM.SomeNode VALUE = NULL;

Can I achieve something similar using the SELECT function?

Anything like

SET OutputRoot.MRM =
SELECT VALUE NULL AS SomeNode


Any suggestion or pointers appreciated.



Cheers

et381
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jul 09, 2009 11:10 pm    Post subject: Re: How to select NULL value from SELECT? Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

et381 wrote:
SET OutputRoot.MRM =
SELECT VALUE NULL AS SomeNode


Why? What's wrong with the other method? What's the requirement here?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jul 10, 2009 4:26 am    Post subject: Re: How to select NULL value from SELECT? Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

et381 wrote:
Can I achieve something similar using the SELECT function


Yes. In general, anything you can do with SET you can do with SELECT.

You may find you're tying yourself into knots trying to do it that way, but it's possible.
Back to top
View user's profile Send private message
et381
PostPosted: Mon Jul 13, 2009 3:16 pm    Post subject: Reply with quote

Newbie

Joined: 09 Jul 2009
Posts: 3

Any pointers to what the syntax might be to achieve this?

The scnerio is for SELECT to fetch data from a database and the database column field is nullable, hence wants to SELECT the NULL value into the message tree.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jul 14, 2009 5:04 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Ah, I see.

Use COALESCE with your column identifier as the first value and an empty value for the second argument.

Set OutputRoot.A.FIELD = SELECT COALESCE(A.MYNULLFIELD, '') from Database.MYDB AS A;

Or you may also, possibly, find interesting results using AS clauses.
Back to top
View user's profile Send private message
et381
PostPosted: Wed Jul 15, 2009 12:02 am    Post subject: Reply with quote

Newbie

Joined: 09 Jul 2009
Posts: 3

Thanks, ended up doing some post processing after the select to set NULL.
Back to top
View user's profile Send private message
mgk
PostPosted: Wed Jul 15, 2009 12:27 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

If it helps, I believe that SELECT does not return NULLs by design, but PASSTHRU does, so if you put your SELECT inside PASSTHRU you will see the NULL values...


Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to select NULL value from SELECT?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.