Mar 4, 2003 #1 blakmk Programmer Feb 12, 2003 17 GB Does anyone know of a way to get the next value of a sequence without inserting it into a table. Ie to get the value into a stored procedure variable. Thanks in advance Mark
Does anyone know of a way to get the next value of a sequence without inserting it into a table. Ie to get the value into a stored procedure variable. Thanks in advance Mark
Mar 4, 2003 #2 gregsimpson Programmer Apr 18, 2002 521 blakmk, SELECT NEXTVAL FOR sequence_name FROM table_expression WHERE something = something. Any table expression should work. I would suggest using SYSIBM.SYSDUMMY1 for your table expression along the lines of SELECT NEXTVAL FOR sequence_name FROM SYSIBM.SYSDUMMY1 WHERE IBM_REQD='Y' Unfortunately I don't have DB2 in front of me, so the statement is untested. Cheers Greg Upvote 0 Downvote
blakmk, SELECT NEXTVAL FOR sequence_name FROM table_expression WHERE something = something. Any table expression should work. I would suggest using SYSIBM.SYSDUMMY1 for your table expression along the lines of SELECT NEXTVAL FOR sequence_name FROM SYSIBM.SYSDUMMY1 WHERE IBM_REQD='Y' Unfortunately I don't have DB2 in front of me, so the statement is untested. Cheers Greg