Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
There is one consideration that I don't see being mentioned
That is how long will the lock be in place? What if the App that initiates the lock hangs? What will happen then?
What will happen to the other uses of this DB resource? _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Thanks for your suggestion. But in our code we are not using any cursor!
Our code is as follows :
Quote:
SET seqnum=SELECT sequence number from table T
check if sequence number is NULL
then
insert sequence number to the table T
chec if sequence number has reached MAX
then
update sequence number to 1
else
update sequence number to sequence number + 1
So shall I use the "SET seqnum = SELECT sequence number from table T for UPDATE" ?
IIB has nothing to do with the sequence number and does not know what the max seq number is... So this whole operation should be performed by the stored procedure on the DB. Just request the next seq number and have a stored proc deliver it to you. _________________ MQ & Broker admin
As am not conversant with stored procedure just checking if by creating ESQL procedure would solve in any way? I suppose that SP should be written in some language and called from ESQL code.
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
mqlover wrote:
As am not conversant with stored procedure just checking if by creating ESQL procedure would solve in any way?
I don't see how
mqlover wrote:
I suppose that SP should be written in some language and called from ESQL code.
A stored procedure would be written in SQL and stored on the database. The clue's in the name.
A stored procedure is nothing more than a sequence of SQL statements (like the SELECT) wrapped in a procedural language and run on the database server rather than passed down from a client. Which is the advantage in your circumstance. _________________ Honesty is the best policy.
Insanity is the best defence.
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