vendredi 26 mai 2017

how can we update trigger with if condition?


create or replace trigger trig1 
after insert on table_1 
for each row 
declare
    v table2.column2%type;
begin
    select table2.column2 
    into v
    from table2 
    where table2.id= :new.id;

    if v is null
    then 
        update table2 
        set table2.column2 = :new.column1 
        where table2.id = :new.id; 
    end if; 
end trig1;



Blockquote

Aucun commentaire:

Enregistrer un commentaire