newbie Trigger with Insert Record
Steve42Sep 17 2008 — edited Sep 17 2008Here's what I want the table to look like
orgn Eventid
3601 1
3601 2
3601 3
3601 ...
4014 1
4014 2
4014 3
4014 ...
I want ALL Eventid to start with 1 for EACH ORGN.
All Eventid MUST be UNIQUE.
When a USER inserts a record, I need it to calculate the next EVENTID #.
CREATE OR REPLACE
TRIGGER EVENT_TGR
Before INSERT ON TESTSEQUENCE
referencing new as new old as old
for each row
declare
v_Eventnum_nr number;
BEGIN
NULL;
select event_seq.nextval INTO :new.Eventnum from testSequence
where :new.fiscalyear=2008 and :new.orgn='3601' and rownum<=1;
END;
I have not been able to figure out how to pass ORGN and FiscalYear to trigger.
Suggestions? Comments?
Thanks.
Steve