Create Sequence Supplier_seq minvalue 1 maxValue 999999999999999 Start with 1 increment by 1 cache 20;
. This would create a sequence object called supplier_seq The first sequence number that it would use is 1 and each subsequent number would increment by 1 (ie: 2,3,4, ...} It will cache up to 20 values for performance. .
Now that you've created a sequence object to simulate an autonumber field, we'll cover how to retrieve a value from this sequence object. To retrieve the next value in the sequence order, you need to use nextval.
For example:
Supplier_seq.nextval
This Would Retrieve The Next Value from Supplier_Seq. The nextVal statement neseds to be used in an sql statement. For example:
INSERT INTO Suppliers (Supplier_ID, Supplier_Name) Values (Supplier_Seq.NextVal, 'Kraft Foods');