Home » Other » Client Tools » debugging of trigger in sql developer (Oracle 10g)
debugging of trigger in sql developer [message #632448] Sat, 31 January 2015 07:01 Go to next message
sss111ind
Messages: 634
Registered: April 2012
Location: India
Senior Member

Hi All,

Debugging is not happening for Trigger in SQL Devloper tool . How I can perform that.

Regards,
Nathan
Re: debugging of trigger in sql developer [message #632449 is a reply to message #632448] Sat, 31 January 2015 07:14 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
sss111ind wrote on Sat, 31 January 2015 05:01
Hi All,

Debugging is not happening for Trigger in SQL Devloper tool . How I can perform that.

Regards,
Nathan


>How I can perform that.
any SQL Client utility can debug PL/SQL when intelligently applied.

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/

"not happening" is not any recognizable Oracle error message.

You need to be smarter than the tool you are (ab)using.

How can we reproduce what you report?

[Updated on: Sat, 31 January 2015 07:23]

Report message to a moderator

Re: debugging of trigger in sql developer [message #632450 is a reply to message #632449] Sat, 31 January 2015 07:33 Go to previous messageGo to next message
sss111ind
Messages: 634
Registered: April 2012
Location: India
Senior Member


I am extremely sorry to trouble you without checking properly.It is working properly.
Thank you.


Regards,
Nathan
Re: debugging of trigger in sql developer [message #632451 is a reply to message #632449] Sat, 31 January 2015 07:37 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Not sure what you mean by "not happening". What exactly happens when you use debugger to step into the line which fires the trigger?
Re: debugging of trigger in sql developer [message #632452 is a reply to message #632451] Sat, 31 January 2015 07:40 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
>It is working properly.

Only you know what wasn't working and what started working. So could you please share what exactly you did.
Re: debugging of trigger in sql developer [message #632453 is a reply to message #632452] Sat, 31 January 2015 08:02 Go to previous messageGo to next message
sss111ind
Messages: 634
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 #632454 is a reply to message #632453] Sat, 31 January 2015 08:10 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
sss111ind wrote on Sat, 31 January 2015 06:02
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;



so if any SALESMAN gets a new manager, they get a 10% raise at the same time. SWEET!
ANY UPDATE to SALESMAN employee record, results in a pay increase for that employee.
Re: debugging of trigger in sql developer [message #635635 is a reply to message #632454] Fri, 03 April 2015 14:25 Go to previous message
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

Previous Topic: How to access database with Toad , No Oracle Software Installed
Next Topic: Info: Toad for free in Mac App Store
Goto Forum:
  


Current Time: Thu Mar 28 06:30:34 CDT 2024