Re: AutoNumber Generation
Date: 1997/04/19
Message-ID: <3358C09E.5217_at_avancer.telebox.fi>#1/1
David E. Daniel wrote:
>
> Hello,
>
> I have a question regarding the use of an automatic number generator in
> Oracle. In MS Access, I can set a field to be an AutoNumber. That way,
> I can use it as a primary key.
>
> I am planning on using MS Access GUI and hitting Oracle via ODBC
> drivers. I need a way to generate a "next number" for my primary key.
> I would like the GUI know what numbers have already been used and to
> generate the next in sequence.
>
> What do I need to set in the Access GUI and/or in the Oracle database to
> perform this function? Any and all help appreciated. You can Email me
> direct or reply to the group. Your preference.
>
> -David
>
> David E. Daniel
> Database Administrator
> Western Michigan University
> david.daniel_at_wmich.edu
David,
it seems that you need a sequence.
INSERT INTO ... VALUES (MY_SEQ.NEXTVAL,...)
generates and uses the next value, and
SELECT MY_SEQ.CURRVAL INTO ... returns the current value.
Regards,
Timo
-- "To no one will we sell, to no one deny or delay right or justice." (Magna Carta 1215) "... still valid ... but with a few minor amendments." (The British Library Board 1976)Received on Sat Apr 19 1997 - 00:00:00 CEST