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 SET NULL as String when calling a Update Query

Post new topic  Reply to topic
 How to SET NULL as String when calling a Update Query « View previous topic :: View next topic » 
Author Message
apmohan
PostPosted: Fri Mar 12, 2021 4:55 am    Post subject: How to SET NULL as String when calling a Update Query Reply with quote

Apprentice

Joined: 28 Dec 2012
Posts: 27

Hello All,

I am writing an ESQL Code to update the Database Table with the provided values,

Request (JSON)
{
"updateEntries": [
{
"seqNo": 9,
"Name": "ABC",
"Age": "25",
"Sex": "MALE",
"City": "XXX"
}
]
}

ESQL Code
Code:

SET query = 'UPDATE Employee SET NAME = ISNULL('|| ''''||name|| '''' ||',NAME),AGE = ISNULL('|| ''''||age|| '''' ||',AGE),SEX = ISNULL('|| ''''||sex|| '''' ||',SEX) WHERE SEQNO ='||CAST(seqNo AS CHARACTER)||'';

PASSTHRU(query);


Issue is when Name is not sent, we need to pass the query as
Quote:
UPDATE Employee SET NAME = ISNULL(NULL,NAME),AGE = ISNULL('39',AGE),SEX = ISNULL('FEMALE',SEX),CITY= ISNULL('YYY',CITY) WHERE SEQNO = 9;


So that it wont override the existing value or else it will replace as NULL.

How to Pass NULL in ESQL as when i do COLEASE(name,NULL) doesnt work.

Please


Last edited by apmohan on Fri Mar 12, 2021 7:06 am; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Fri Mar 12, 2021 6:21 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

Do you mean null or ‘null’ ?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
apmohan
PostPosted: Fri Mar 12, 2021 7:01 am    Post subject: Reply with quote

Apprentice

Joined: 28 Dec 2012
Posts: 27

bruce2359 wrote:
Do you mean null or ‘null’ ?


I mean NULL only I don't want as String'NULL'
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Fri Mar 12, 2021 9:10 am    Post subject: Re: How to SET NULL as String when calling a Update Query Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

apmohan wrote:
... when i do COLEASE(name,NULL) doesnt work.

What do you mean by doesn't work? Does it throw an error? Something else?
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
apmohan
PostPosted: Fri Mar 12, 2021 3:46 pm    Post subject: Re: How to SET NULL as String when calling a Update Query Reply with quote

Apprentice

Joined: 28 Dec 2012
Posts: 27

bruce2359 wrote:
apmohan wrote:
... when i do COLEASE(name,NULL) doesnt work.

What do you mean by doesn't work? Does it throw an error? Something else?


Sorry Bruce for not clarifying.. I getting an error that the Variable query is null due to which it is throwing exception.

And when I pass it as COLEASE(name,'NULL') it overwrites the existing value
Back to top
View user's profile Send private message Send e-mail
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 SET NULL as String when calling a Update Query
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.