| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> [Newbie] Serial Keys - How to implement
I guess this is probably a RTFM, but the product has yet to be delivered,
so
I haven't got a manual yet, bummer.
Anyhoo...
How would I go about implementing an equivelant to the Informix serial data
type
in an Oracle database?
If I have a table like this:
CREATE TABLE customer ( customer INTEGER NOT NULL, name CHAR(32) NOT NULL, PRIMARY KEY (customer) );
How do I make a statement like this:
INSERT INTO customer VALUES (0, 'Baney Rubble');
auto increment the value of the primary key?
I guess I'm going to need a trigger/procedure pair, but do I need to create
a
table that stores the last used key? (give it row level locking, select and
update
in one transaction?) or do I just do a select MAX(customer) in the proc?
Any and all advice much appreciated.
Free T-Shirt for the best answer! (no kidding)
Thanks!
![]() |
![]() |