Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: help getting a trigger inserted value
Here's what I use:
create table my_table
(my_table_id number,
:
:
);
create sequence seq_my_table_id start with 1 increment by 1;
create or replace trigger tr_my_table_id
before insert on my_table
for each row
begin
if :new.my_table_id is null then
select seq_my_table_id.nextval into :new.my_table_id from dual; : my_procedure(:new.my_table_id);
Remember:
triggers may be compiled each time they fire, so keep code to a minimum (call a procedure rather than embed the statments in a trigger)
:new and :old only work on "for each row" triggers.
"Greg Gale" <ggpro_at_my-deja.com> wrote in message
news:8qtnbp$k09$1_at_nnrp1.deja.com...
> I'm looking for some help with getting the a value inserted by a
> trigger. I'm populating the primary key of a table using an insert row
> trigger which grabs the number from a sequence. How do I get the value
> that was inserted by the trigger so I can pass it to a procedure after
> inserting the row.
>
> Thanks.
>
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Wed Sep 27 2000 - 16:22:26 CDT
![]() |
![]() |