|
|
|
|
|
Re: debugging of trigger in sql developer [message #632453 is a reply to message #632452] |
Sat, 31 January 2015 08:02 |
|
sss111ind
Messages: 636 Registered: April 2012 Location: India
|
Senior Member |
|
|
As my condition was not appropriate so the trigger was failing.
create or replace
PROCEDURE sal_percent
IS
BEGIN
UPDATE emp SET sal=SAL+(SAL)*(10/100) WHERE JOB='KINGA';--wrong
end;
create or replace
TRIGGER hiredate_trg
BEFORE UPDATE ON emp
FOR EACH ROW
BEGIN
IF :OLD.JOB='SALESMAN' THEN
:NEW.SAL:=:NEW.SAL+(:new.SAL)*(10/100);
END IF;
END;
[Updated on: Sat, 31 January 2015 08:03] Report message to a moderator
|
|
|
|
Re: debugging of trigger in sql developer [message #635635 is a reply to message #632454] |
Fri, 03 April 2015 14:25 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
It would be cleaner to simply use and what is the trigger do if they simply update something besides job. You have to restrict the trigger or they will be getting a raise every time the user is updated.
create or replace
TRIGGER hiredate_trg
BEFORE UPDATE ON emp
FOR EACH ROW
BEGIN
IF :OLD.JOB='SALESMAN'
and :new.job <> 'SALESMAN' THEN
:NEW.SAL:=:NEW.SAL * 1.10;
END IF;
END;
[Updated on: Fri, 03 April 2015 14:29] Report message to a moderator
|
|
|