Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    6

    Unanswered: Getting value of auto increment key field

    I am sure this has been done many times: I have an auto increment key field, say order_No, and on inserting an order I need to know the value of order_no so I can insert order lines linked to the order. How do I retrieve this value? I am already thinking about work-arounds like keeping the numbers in a separate table.
    Best Regards

  2. #2
    Join Date
    Jan 2004
    Posts
    492

    Re: Getting value of auto increment key field

    Originally posted by serogole
    I am sure this has been done many times: I have an auto increment key field, say order_No, and on inserting an order I need to know the value of order_no so I can insert order lines linked to the order. How do I retrieve this value? I am already thinking about work-arounds like keeping the numbers in a separate table.
    Best Regards

    Select seq_name.currval
    from dual;

  3. #3
    Join Date
    Feb 2004
    Posts
    6

    Re: Getting value of auto increment key field

    Thanks, I got it - www.mysql.com/ articles/autoincrement-with-connectorj.html
    Best Regards

    Originally posted by ss659
    Select seq_name.currval
    from dual;

Posting Permissions

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