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 OR UPDATE TRIGGER

895550Dec 27 2011 — edited Dec 27 2011
Hi,

I wrote a Trigger on mtl_kanban_cards table (AFTER INSERT OR UPDATE) , if the supply_status = 5 then i have to select few columns from mtl_kanban_cards & mtl_system_items_b and populate the custom table.
Not sure why below (code) trigger is not firing, could you let me know if i have to make any changes to the code.

CREATE OR REPLACE TRIGGER apps.mtl_kan_trg
AFTER INSERT OR UPDATE
ON mtl_kanban_cards
REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW

DECLARE

BEGIN
IF :NEW.supply_status = 5 THEN

INSERT INTO XXHI_KAN_ONHAND VALUE
(SELECT kb.kanban_card_number,itm.segment1,moqd.transaction_quantity
FROM mtl_system_items_b itm
,mtl_kanban_cards kb
,mtl_onhand_quantities_detail moqd
WHERE itm.inventory_item_id = :NEW.inventory_item_id
AND itm.organization_id = :NEW.organization_id
AND moqd.inventory_item_id = itm.inventory_item_id
AND itm.organization_id = moqd.organization_id
AND moqd.subinventory_code = :NEW.source_subinventory
AND kb.kanban_card_number = :NEW.kanban_card_number
AND kb.kanban_card_id = :NEW.kanban_card_id
GROUP BY
itm.segment1,moqd.transaction_quantity);

END IF;
DBMS_OUTPUT.put_line ('Update Succesfull');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Update failed');
END;


Thanks
Pravin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 24 2012
Added on Dec 27 2011
12 comments
1,283 views