Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: CREATING SEQUENCES - HELP PLEASE

Re: CREATING SEQUENCES - HELP PLEASE

From: Cecil D'Souza <cecil_at_total.net>
Date: 1997/10/20
Message-ID: <344c0560.0@news.total.net>#1/1

You must use a Pre_insert trigger where you

Select miSEQ.NEXTVAL into some variable v_emp_id from dual. or you can select into a bind variable directly.

If you select into a variable you should assign that variable to the bind variable which will be a base table item.

:Block name.emp_id := v_emp_id;

Then when you insert the values into the new record with INSERT, the record automatically gets the value of miSEQ.nextval. NEXTVAL is a pseudocolumn.

See Oracle's online help or SQL manual for examples. It is clearly given. If you don't have Steven Feuerstein's PL/SQL book, you won't learn much. Also rememer when caching, you will not necessarily get the numbers in order as they tend to skip. If the system crashees you will lose all the numbers of the records that are not committted. This is only when caching the sequence numbers.

Cecil Received on Mon Oct 20 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US