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

Home -> Community -> Usenet -> c.d.o.tools -> Trigger Help

Trigger Help

From: Steven C Job <job_at_cs.buffalo.edu>
Date: 1998/02/20
Message-ID: <6ck671$3da$1@prometheus.acsu.buffalo.edu>#1/1

I know this can't be too tough, but I just can't seem to get it done.

I have a sequence called empl_seq.
When I insert into the the table (employee) I want it to put the sequence number into the employee table, and then insert the sequence number again in two other tables, with extra data.

So here is the before insert trigger which does NOT work.

create or replace trigger employee_before_ins_row before insert on EMPLOYEE
for each row
begin
:new.seq_num := :empl_seq.nextval;
end;

Here is the trigger which does work. This one takes the seq_num and makes the relationship in two other tables.

create or replace trigger employee_after_ins_row after insert on EMPLOYEE
for each row
begin
insert into employee_checklist values (:new.seq_num,

0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

insert into employee_accounts values (:new.seq_num, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
end;

Any help here would be extremely appreciated....

Thank you, thank you, thank you....

-Steven Job Received on Fri Feb 20 1998 - 00:00:00 CST

Original text of this message

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