By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,610 Members | 2,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,610 IT Pros & Developers. It's quick & easy.

Data confilicts

P: n/a
Hello.
v8.2.7

I have read
http://publib.boulder.ibm.com/infoce...d/c0009164.htm
and I need clarification for creation and removing a "table access
context":

Suppose I want to store, retrieve and increment id's for some tables.
I have such table and procedure:
---
create table confl_mx (name varchar(35), pk int)@

CREATE PROCEDURE CONFL_GET_PK(IN NAME VARCHAR(35), OUT PK INTEGER)
LANGUAGE SQL
MODIFIES SQL DATA
BEGIN
SELECT old_pk into pk
FROM FINAL TABLE
(
UPDATE confl_mx INCLUDE (old_pk int)
SET old_pk = pk, pk = pk + 1
WHERE name = CONFL_GET_PK.NAME
) T;
END@
---
Questions are:
1.
why this procedure works:
---
CREATE PROCEDURE CONFL_GET
LANGUAGE SQL
BEGIN ATOMIC
DECLARE PK INT;
CALL CONFL_GET_PK('NAME1', PK);
CALL CONFL_GET_PK('NAME2', PK);
END@
---
and why this code throws SQL0746 on the second call of the procedure:
---
BEGIN ATOMIC
DECLARE PK INT;
CALL CONFL_GET_PK('NAME1', PK);
CALL CONFL_GET_PK('NAME2', PK);
END@
---
I've thought, that after first call of the procedure its "table access
context" should be removed?
2.
Anyway could anybody explain the life cycle of these "table access
context"s?

Thanks in advance,
Mark B.

Feb 27 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.