470,833 Members | 1,329 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

Getting next val in a sequence when the table is empty

Hi All,

I want to get the next val in a sequence and then use it to do an
insert. I can do this to get the next val:

select NEXTVAL for EAIDATA.SUPPLIER_TP_SEQ_NO from EAIDATA.SUPPLIER_TP;

But if EAIDATA.SUPPLIER_TP is empty, this fails - "0 records selected".
How can I get the next value of a sequence without referring to a
table?

Kind regards,

Rob
:)

Nov 12 '05 #1
2 2239
Values NEXTVAL for EAIDATA.SUPPLIER_TP_SEQ_NO

Nov 12 '05 #2
p175 wrote:
Values NEXTVAL for EAIDATA.SUPPLIER_TP_SEQ_NO


SELECT NEXTVAL FOR EAIDATA.SUPPLIER_TP_SEQ_NO FROM sysibm.sysdummy1

This table always has a single row.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by python1 | last post: by
1 post views Thread by ben f | last post: by
5 posts views Thread by Eric E | last post: by
54 posts views Thread by bearophileHUGS | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.