create or replace trigger Trig On Test1 after insert or update on mytest1 referencing OLD as old NEW as new for each row WHEN (new.col1 = 100) begin :new.col3 = 500; end; Brian IF :new.col1 = 100 THEN :new.col3 = 300 END IF; Let me know why this solution won't work in your situation.
Balaji" id="ctl00_m_m_i_ctl00_gr_ctl07_bestanswerbody" class="textarea-bestanswerhidden" name="bestanswerbody" answerbody Id="1455176" / Change your trigger to before insert and instead of calling another procedure use the below if statement IF :new.col1 = 100 THEN :new.col3 = 300 END IF; Let me know why this solution won't work in your situation.
Should any right be infringed, it is totally unintentional.
Drop me an email and I will promptly and gladly rectify it.
Nidhi" id="ctl00_m_m_i_ctl00_gr_ctl25_bestanswerbody" class="textarea-bestanswerhidden" name="bestanswerbody" answerbody Id="1455371" / You can try something like this, depending upon the value of a column, you can either call any function, procedure which return value to the trigger...
create or replace trigger TRBIU_Test Employees before insert or update on Employees referencing OLD as old NEW as new for each row begin :new.email := Case when :new.employee_id = 1000 then func1(1000) when :new.employee_id = 1002 then [email protected]' End; If :new.employee_id = 1001 then PROC2(:new.employee_id,:new.email); end if; end; where PROC2 is something like this CREATE OR REPLACE PROCEDURE PROC2 ( Emp_Id_IN IN VARCHAR2 , Email_OUT OUT VARCHAR2 ) AS BEGIN If Emp_Id_IN = 1001 then Email_OUT := [email protected]'; end if; END PROC2; Hope this would help to resolve the issue....
Use the WHEN clause to prevent the trigger from firing for every insert and update.
The differences in syntax are quite dramatic compared to other database systems like MS SQL Server or My SQL. Updates based on two or more common columns are normally used for tables where multiple columns work together as a primary key (known as composite primary key).You can find the original table definitions in the "$ORACLE_HOME/rdbms/admin/utlsampl.sql" script.