If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Getting value of auto increment key field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-16-04, 14:24
serogole serogole is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
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
Reply With Quote
  #2 (permalink)  
Old 02-16-04, 15:14
ss659 ss659 is offline
Registered User
 
Join Date: Jan 2004
Posts: 492
Re: Getting value of auto increment key field

Quote:
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;
Reply With Quote
  #3 (permalink)  
Old 02-16-04, 16:33
serogole serogole is offline
Registered User
 
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

Quote:
Originally posted by ss659
Select seq_name.currval
from dual;
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On