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!

Trigger Update Not Updating (SOLVED)

542539Sep 15 2007 — edited Sep 15 2007

This trigger is not updating a HAZ_MATERIAL field in an item master table (and it should be updating it). After I update the item master record, or delete and recreate it, the HAZ_MATERIAL field is still null.

I can run the query with the item number hard-coded into it, and Oracle returns a '1', so I'm fairly sure the query is working. Nevertheless, I haven't written a ton of triggers, so this could be something completely trivial.

create or replace
trigger tr_item_master_hazmat
before insert or update on t_item_master
for each row
declare
    isHazmat char(1);
begin
    isHazmat := '0';

    select      '1'
    into        isHazmat
    from        t_item_master           itm
    inner join  v_item_dcl_supplier     ora
    on          ora.inventory_item_id   = itm.oracle_inventory_item_id
    inner join  spwh_hazmat_dcl         haz
    on          haz.dept                = ora.dept
    and         haz.class               = ora.class
    and         haz.line                = ora.line
    where       itm.item_number         = :new.item_number;

    if isHazmat = '1'
    then
        :new.haz_material := '1';
    end if;
exception
    when no_data_found
    then
        null;
    when others
    then
        null;
end tr_item_master_hazmat;

Thanks for your time and assistance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 13 2007
Added on Sep 15 2007
7 comments
1,161 views