user2584492
user2584492

Reputation: 11

Oracle Compound Trigger issue

(Using Oracle 11G)

So I have this UPDATE trigger, its job is to get a single row from my ccv_p TABLE and insert it into my oldRecord RECORD in a before each statement (It's a compound trigger), then after that, I'd like to get the PRC_ID of that row through oldRecord in an after each row statement...doesn't seem to be working though, it doesn't insert anything into my test table. Through some debugging i've found out that my problem lies with the select statement, but i'm not really too experienced in Oracle...Any thoughts? Here's some important snippets of code:

oldRecord CCV_P%ROWTYPE;

select ccv_p.* into oldRecord from ccv_p inner join parcel on ccv_p.prc_id = parcel.prc_id where ccv_p.PRC_ID = :new.PRC_ID;

insert into TEST$_TABLE (TEST$_TABLE.num) VALUES (oldRecord.PRC_ID);

Upvotes: 0

Views: 139

Answers (1)

Ricardo Arnold
Ricardo Arnold

Reputation: 913

Is the trigger defined for the CCV_P table? in that case, you don't need to query the table. What you probably want to do is:

1) populate your recordtype

my_rec.PRC_ID := :old.PRC_ID;

2) Insert into your table

insert into TEST$_TABLE (TEST$_TABLE.num) VALUES (:old.PRC_ID);

This will of course not work for Inserts

Upvotes: 0

Related Questions