Commit eb6b753c authored by akhokar's avatar akhokar

Trigger added to update employee status as ' ' on creation of new employee.

TRG_UPD_EMPNAMES.SQL


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@200812 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 21d43ec5
set DEFINE oFF;
Trigger Trg_Upd_Empnames Before Insert Or Update On Employee
REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW
BEGIN
IF :NEW.EMP_FNAME_LONG IS NULL AND :NEW.EMP_FNAME IS NOT NULL THEN
:NEW.EMP_FNAME_LONG := :NEW.EMP_FNAME;
ELSIF :NEW.EMP_FNAME_LONG IS NOT NULL AND :NEW.EMP_FNAME IS NULL THEN
:NEW.EMP_FNAME := TRIM(SUBSTR(:NEW.EMP_FNAME_LONG,1,15)) ;
ELSIF :NEW.EMP_FNAME_LONG <> :OLD.EMP_FNAME_LONG AND :NEW.EMP_FNAME = :OLD.EMP_FNAME THEN
:NEW.EMP_FNAME := TRIM(SUBSTR(:NEW.EMP_FNAME_LONG,1,15)) ;
ELSIF :NEW.EMP_FNAME_LONG = :OLD.EMP_FNAME_LONG AND :NEW.EMP_FNAME <> :OLD.EMP_FNAME THEN
:NEW.EMP_FNAME_LONG := :NEW.EMP_FNAME;
END IF;
IF :NEW.EMP_MNAME_LONG IS NULL AND :NEW.EMP_MNAME IS NOT NULL THEN
:NEW.EMP_MNAME_LONG := :NEW.EMP_MNAME;
ELSIF :NEW.EMP_MNAME_LONG IS NOT NULL AND :NEW.EMP_MNAME IS NULL THEN
:NEW.EMP_MNAME := TRIM(SUBSTR(:NEW.EMP_MNAME_LONG,1,15)) ;
ELSIF :NEW.EMP_MNAME_LONG <> :OLD.EMP_MNAME_LONG AND :NEW.EMP_MNAME = :OLD.EMP_MNAME THEN
:NEW.EMP_MNAME := TRIM(SUBSTR(:NEW.EMP_MNAME_LONG,1,15)) ;
ELSIF :NEW.EMP_MNAME_LONG = :OLD.EMP_MNAME_LONG AND :NEW.EMP_MNAME <> :OLD.EMP_MNAME THEN
:NEW.EMP_MNAME_LONG := :NEW.EMP_MNAME;
END IF;
IF :NEW.EMP_LNAME_LONG IS NULL AND :NEW.EMP_LNAME IS NOT NULL THEN
:NEW.EMP_LNAME_LONG := :NEW.EMP_LNAME;
ELSIF :NEW.EMP_LNAME_LONG IS NOT NULL AND :NEW.EMP_LNAME IS NULL THEN
:NEW.EMP_LNAME := TRIM(SUBSTR(:NEW.EMP_LNAME_LONG,1,15)) ;
ELSIF :NEW.EMP_LNAME_LONG <> :OLD.EMP_LNAME_LONG AND :NEW.EMP_LNAME = :OLD.EMP_LNAME THEN
:NEW.EMP_LNAME := TRIM(SUBSTR(:NEW.EMP_LNAME_LONG,1,15)) ;
ELSIF :NEW.EMP_LNAME_LONG = :OLD.EMP_LNAME_LONG AND :NEW.EMP_LNAME <> :OLD.EMP_LNAME THEN
:NEW.EMP_LNAME_LONG := :NEW.EMP_LNAME;
END IF;
end;
/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment