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: Sequences at Oracle

Re: Sequences at Oracle

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 25 Oct 2001 10:18:21 +0200
Message-ID: <ttfjcqhk2j2l8c@corp.supernews.com>

"Yaron Avior" <yavior_at_mercury.co.il> wrote in message news:1b00d968.0110250008.b91a6b_at_posting.google.com...
> Hi,
> In SQL-Server, when you enter a new record to a table with an
> identity, this column's value is inserted automaticly after the last
> value is incremented.
> is it the same at Oracle (if I have a sequence) or I need to increment
> the sequence myself?
> can someone bring an example???
>
> thanks.

oracle application developers manual should have examples and the comp.databases.oracle.* hierarchy should also have many one of them as no one seems to be willing to search the archives at http://groups.google.com

but here goes (in plain English, and not in Hebrew, though I can read it)

create or replace trigger emp_biufer before insert or update on emp for each row
begin
select <sequence_name>.nextval
into :new.empno
from dual;
end;
/

and that is all there is to it.

Regards
Sybrand Bakker
Senior Oracle DBA Received on Thu Oct 25 2001 - 03:18:21 CDT

Original text of this message

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