Results 1 to 6 of 6
  1. #1
    Join Date
    May 2009
    Posts
    7

    Unanswered: db2 sequence object

    how do i access db2 sequence object to generate a unique sequence number?

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Nextval For Seqname
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    May 2009
    Posts
    7
    Quote Originally Posted by sathyaram_s
    Nextval For Seqname
    I dont know why this doesn't work for me in data studio. can i retrieve this using sql query like ' select Nextval for seq_name; ?

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by sgogula
    can i retrieve this using sql query like ' select Nextval for seq_name; ?
    No, because this is an incomplete SQL query; it must have at least a FROM clause. Try "values nextval for seq_name" instead.
    ---
    "It does not work" is not a valid problem statement.

  5. #5
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    or if you want to use SELECT, you can do

    SELECT NEXTVAL FOR SEQNAME FROM SYSIBM.SYSDUMMY1

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  6. #6
    Join Date
    May 2009
    Posts
    7
    Quote Originally Posted by sathyaram_s
    or if you want to use SELECT, you can do

    SELECT NEXTVAL FOR SEQNAME FROM SYSIBM.SYSDUMMY1

    Cheers
    Sathyaram
    Thanks Sathyaram for the solution. This works perfectly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •