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 » ESQL equalent code to IDENTITY_VAL_LOCAL()

Post new topic  Reply to topic
 ESQL equalent code to IDENTITY_VAL_LOCAL() « View previous topic :: View next topic » 
Author Message
ushak
PostPosted: Wed Jan 30, 2013 6:54 am    Post subject: ESQL equalent code to IDENTITY_VAL_LOCAL() Reply with quote

Newbie

Joined: 28 Jan 2013
Posts: 8

HI ,
I'm using below code to get the last generated IDENTITY after an insert statement. Basically I'm doing an insert which will auto generate an ID in the table and I need the ID value back to WMB for further processing.

PASSTHRU('SELECT IDENTITY_VAL_LOCAL() AS ID FROM SYSIBM.SYSDUMMY1');

Other than using passthru , is there a way to get the IDENTITY using native esql code?
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Jan 30, 2013 7:05 am    Post subject: Re: ESQL equalent code to IDENTITY_VAL_LOCAL() Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

ushak wrote:
HI ,
I'm using below code to get the last generated IDENTITY after an insert statement. Basically I'm doing an insert which will auto generate an ID in the table and I need the ID value back to WMB for further processing.

PASSTHRU('SELECT IDENTITY_VAL_LOCAL() AS ID FROM SYSIBM.SYSDUMMY1');

Other than using passthru , is there a way to get the IDENTITY using native esql code?


You mean by using the Database node? What's wrong with PASSTHRU?
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
ushak
PostPosted: Wed Jan 30, 2013 7:13 am    Post subject: Reply with quote

Newbie

Joined: 28 Jan 2013
Posts: 8

I'm using compute node.
I do not want passthru as I dont want any code to be DB specific. It should work for a different database also.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Jan 30, 2013 7:24 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

ushak wrote:
I'm using compute node.
I do not want passthru as I dont want any code to be DB specific. It should work for a different database also.


SELECT IDENTITY_VAL_LOCAL() AS ID FROM SYSIBM.SYSDUMMY1 is specific to DB2. You must write SQL statements in the database de'jour.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Jan 30, 2013 7:25 am    Post subject: Reply with quote

Grand High Poobah

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

ushak wrote:
I do not want passthru as I dont want any code to be DB specific. It should work for a different database also.


But most database systems store & generate id values in different places and in different formats, so any ESQL code that relies on this value in inherently DB specific.

If all you want is an identity value to use in your ESQL you can obtain it from one of the UUIDAS.... ESQL functions.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jan 30, 2013 8:23 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If you want to return database specific information to Broker using a non-database specific method, you need to write a database specific stored procedure and use the non-specific CALL statement in ESQL to invoke the stored procedure.

Then you change the definition of the stored procedure across different databases but not the declaration.
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 » ESQL equalent code to IDENTITY_VAL_LOCAL()
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.