DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: SEQUENCE FOR VALUES IN INSERT CLAUSE

  1. #1
    Join Date
    Apr 2001
    Location
    London
    Posts
    725
    Hi,

    Can anyone please give me the syntax for using a sequence in the values clause of an insert statement :

    e.g
    insert into table1(id)
    values (select seq.nextval from sys.dual)

    the above is not correct syntax.

    Thanks

    Suresh

  2. #2
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    Try:

    insert into EMP values (emp_seq.nextval, ....);

    commit;

    I have read on this board that selecting the next sequence value from dual can leave open cursors.

    Good luck.
    David Knight
    OCP DBA 8i, 9i, 10g

  3. #3
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339
    Actually, try:

    insert into table1(id)
    select seq.nextval from sys.dual;


    - Chris

  4. #4
    Join Date
    Apr 2001
    Location
    London
    Posts
    725
    Thanks guys,

    Both solutions worked.

Posting Permissions

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


Click Here to Expand Forum to Full Width