Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

After Insert Trigger Not Working

KINGSep 9 2008 — edited Sep 11 2008
Hi All,

I am not a guru in writing triggers.

I am inserting new records in a Table FA_BOOKS by application and this inserts records in FA_ADDITIONS_B. This is a vanilla process.

i have written a trigger on FA_ADDITIONS_B, and i want to update the cost from the fa_books to fa_additions_b column attribute21

The trigger i have written is After insert on FA_ADDITIONS_B and i try to select cost from the fa_books for the :new.asset_id.

SELECT COST
INTO v_cost
FROM FA_BOOKS
WHERE ASSET_ID = :NEW.ASSET_ID;

this is always returning no_data_found exception and i do not understand how to update the attribute21 in FA_ADDITIONS_B

Here is a sample of my trigger.

CREATE OR REPLACE TRIGGER update_attribute21_new_asset_1
after INSERT ON fa_ADDITIONS_B
FOR EACH ROW
DECLARE
V_COST NUMBER;
BEGIN

SELECT COST
INTO v_cost
FROM FA_BOOKS
WHERE ASSET_ID = :NEW.ASSET_ID;

update fa_ADDITIONS_B
set attribute21 = v_cost
where ASSET_ID = :NEW.ASSET_ID;

END;


Any help on this will be appreciated.

TX in advance.

Regards,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 9 2008
Added on Sep 9 2008
14 comments
986 views