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 » Passing table column name to esql procedure + help

Post new topic  Reply to topic
 Passing table column name to esql procedure + help « View previous topic :: View next topic » 
Author Message
shika123
PostPosted: Tue Sep 08, 2009 8:50 pm    Post subject: Passing table column name to esql procedure + help Reply with quote

Novice

Joined: 08 Sep 2009
Posts: 15

Hii,

I have an esql stmnt DELETE FROM Database.XXX.Table1 AS R WHERE R.INVOICECODE >= XVAL AND R.INVOICECODE <= YVAL; which works fine..

Now I want to keep this esql delete stmnt in an esql function as I have many different column names on which records are deleted..(I get diff column names from Input)

I feel I cannot pass the columnname to the procedure as argument.

..call Proc1(x,x,columnname) : as when this Proc1 contains above esql Delete stmnt, it will have R.columnname which will search the variable name in Table...

Any Ideas/suggestions how to customise this..
Back to top
View user's profile Send private message
gregop
PostPosted: Tue Sep 08, 2009 11:52 pm    Post subject: Reply with quote

Voyager

Joined: 24 Nov 2006
Posts: 81

You can create your SQL statement as a string, then run as PASSTHRU. Something like:

SET sqlStatement = ('DELETE FROM TABLE1 WHERE ' || col1 || '=' || value1)

PASSTHRU(sqlStatement)

Alternatively take a look at esql EVAL statement to run a dymamic esql staement.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Wed Sep 09, 2009 1:16 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi,

Wouldn't R.{columnNameArgument} work ?

Regards.
Back to top
View user's profile Send private message Send e-mail
shika123
PostPosted: Wed Sep 09, 2009 1:31 am    Post subject: Reply with quote

Novice

Joined: 08 Sep 2009
Posts: 15

Wouldn't R.{columnNameArgument} work ?


No It did not work..It cried as a syntax error
Back to top
View user's profile Send private message
sapana
PostPosted: Thu Sep 10, 2009 4:11 am    Post subject: Reply with quote

Apprentice

Joined: 16 Apr 2007
Posts: 33
Location: Pune

Try declaring columnName in function declaration to be of 'NAME' type.
I had tried this to pass tableName, the way you are trying to pass columnName and it worked.
Back to top
View user's profile Send private message
shika123
PostPosted: Thu Sep 10, 2009 9:57 pm    Post subject: Reply with quote

Novice

Joined: 08 Sep 2009
Posts: 15

Try declaring columnName in function declaration to be of 'NAME' type.
I had tried this to pass tableName, the way you are trying to pass columnName and it worked.



I tried..It worked for Table name..but not for column name .,,as am giving as R.ColumnName (using the reference)...
Back to top
View user's profile Send private message
sapana
PostPosted: Fri Sep 11, 2009 1:30 am    Post subject: Reply with quote

Apprentice

Joined: 16 Apr 2007
Posts: 33
Location: Pune

I tried it as tableName.columnName and it worked.
But would like to know, which alternative is better, using PASSTHRU(sqlStatement) or the above one and why?
Back to top
View user's profile Send private message
shika123
PostPosted: Fri Sep 11, 2009 4:17 am    Post subject: Reply with quote

Novice

Joined: 08 Sep 2009
Posts: 15

Got it thri PAssthru stmnt..

I guess passthru is better...
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 » Passing table column name to esql procedure + help
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.