Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Check on column when record is updated

Check on column when record is updated

From: AcCeSsDeNiEd <dillon_at_rm_accessdenied.darktech.org>
Date: Wed, 22 Jan 2003 15:23:44 +0800
Message-ID: <thhs2v4vu1t495mrd69s23o8hbkjab3ujo@4ax.com>


What I need is to make sure my application vendor always updates the "Mod_De_Emp_Id" (Modified Date-Entry Employee ID) column for the record that is being modified. It is nullable on inserts (I have another field "De_Emp_Id" that is not null).

Is there a way in the trigger that I can check whether an input for "Mod_De_Emp_Id" has been made? What I need is to make sure my application vendor always updates the "Mod_De_Emp_Id" (Modified Date-Entry Employee ID) column for the record that is being modified. It is nullable on inserts.

Maybe something like:

IF :input.Mod_De_Emp_Id is null

      THEN RAISE_APPLICATION_ERROR(-20110, 'Need an updated Mod_Emp_Id for Modifications.');     END IF; I have searched the net but did not come up with much. Made something up.
This is half-working:

BEGIN

	IF :new.Mod_De_Emp_Id is null
		THEN RAISE_APPLICATION_ERROR(-20110, 'Need an updated  Mod_Emp_Id.');
   	 END IF;
    
	IF :NEW.Mod_De_Emp_Id = :OLD.Mod_De_Emp_Id
		THEN RAISE_APPLICATION_ERROR(-20110, 'Need an updated  Mod_Emp_Id for
Modifications.');
    	END IF;

END; The above works fine except that if the same employee did the data-entry for both the old and new records, we have a problem. It's gonna give out an error for a genuine update.

Any pointers?

To e-mail me, remove "rm_" Received on Wed Jan 22 2003 - 01:23:44 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US