|
-
I have a trigger that does half of what I would like it to do.
For every record that is inserted, it gets the pidm correctly.
Now, if a record has a pidm, I would like to set the tran_number to 1 or increment the tran_number for that pidm. With that added, the trigger won't compile. I'm getting ora-600 internal errors. Here is what I got so far...
create or replace trigger tzgprnt_insert_pidm
before insert on tzgprnt
for each row
declare
pidm number;
tran_number number;
begin
select distinct gwsntid_pidm into pidm
from gwsntid
where gwsntid_netid = :new.tzgprnt_netid;
:new.tzgprnt_pidm := pidm;
exception
when no_data_found then
tzgprnt_pidm := null;
if pidm not null then
select max(tzgprnt_tran_number) +1 into tran_number
from tzgprnt
where tzgprnt_pidm = pidm;
:new.tzgprnt_tran_number := tran_number;
exception
when no_data_found then
:new.tzgprnt_tran_number := 1;
end if;
end;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|