Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

DB2 Sequence

$
0
0
Hi,

DB2 9.7 FP 4 /WIN 2008

I am trying to workout a sequence question (found in a db2 book). can you give some explanation that how it works please?

A sequence was created with the DDL statement shown below:
CREATE SEQUENCE my_seq START WITH 10 INCREMENT BY 10 CACHE 10
User USER1 successfully executes the following statements in the order shown:
VALUES NEXT VALUE FOR my_seq INTO :hvar;
VALUES NEXT VALUE FOR my_seq INTO :hvar;
User USER2 successfully executes the following statements in the order shown:
ALTER SEQUENCE my_seq RESTART WITH 5 INCREMENT BY 5 CACHE 5;
VALUES NEXT VALUE FOR my_seq INTO :hvar;
After users USER1 and USER2 are finished, user USER3 executes the following
query: SELECT NEXT VALUE FOR my_seq FROM sysibm.sysdummy1
What value will be returned by the query?


I am getting the answer 10. (i didnt have a test enviornment to test this).
Thanks.

Viewing all articles
Browse latest Browse all 13329

Trending Articles