Forum Stats

  • 3,784,135 Users
  • 2,254,897 Discussions
  • 7,880,705 Comments

Discussions

Debugger Does Not Break on Breakpoints

marcusafs
marcusafs Member Posts: 294 Red Ribbon
edited May 1, 2014 7:26PM in SQL Developer

I am running one of the tutoials, Testing and Debugging Procedures using SQL Developer 3.1 and am trying to run AWARD_BONUS in debug mode with a break on the select statement as directed by the tutorial.  The first time something about a problem with my firewall and I clicked OK on the error and the proc ran without breaking.  Of course I didn't make notes of the error and now I cannot reproduce it.  Is there a log that might explain what happened?  Can anyone help?  Here is the message output of the run.

Connecting to the database hr_orcl.

Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE

Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( '172.22.9.9', '50911' )

Debugger accepted connection from database on port 50911.

Executing PL/SQL: CALL DBMS_DEBUG_JDWP.DISCONNECT()

Salary for Employee ID 149 currently is: 14900

Commission Percentage for 149 currently is: .2

Salary for Employee ID 149 will be changed to: 15300

Process exited.

Disconnecting from the database hr_orcl.

Debugger disconnected from database.

And here is the proc

create or replace PROCEDURE award_bonus (

  emp_id NUMBER, sales_amt NUMBER) AS

  l_salary    REAL;

  l_commission    REAL;

  comm_missing  EXCEPTION;

BEGIN

  SELECT salary, commission_pct INTO l_salary, l_commission    --********BREAK POINT SET HERE********

    FROM employees

      WHERE employee_id = emp_id;

    dbms_output.put_line('Salary for Employee ID '||emp_id||' currently is: '||l_salary);

    dbms_output.put_line('Commission Percentage for '||emp_id||' currently is: '||l_commission);   

  IF l_commission IS NULL THEN

    RAISE comm_missing;

  ELSE

    l_salary := l_salary  + sales_amt*l_commission;

    dbms_output.put_line('Salary for Employee ID '||emp_id||' will be changed to: '||l_salary);   

    UPDATE employees

      SET salary = l_salary

        WHERE employee_id = emp_id;

   

  END IF;

END award_bonus;

Best Answer

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,269 Employee
    Accepted Answer

    To clarify - are you saying the 1st time the breakpoint wasn't honored, but now it is?

    Or the breakpoint STILL isn't being used?

    The most likely causes for breakpoints not 'breaking' execution are:

    • unit not compiled with debug
    • breakpoint added to a line of code that's not 'executable' (like a comment)
    • breakpoint condition evals to false


Answers

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,269 Employee
    Accepted Answer

    To clarify - are you saying the 1st time the breakpoint wasn't honored, but now it is?

    Or the breakpoint STILL isn't being used?

    The most likely causes for breakpoints not 'breaking' execution are:

    • unit not compiled with debug
    • breakpoint added to a line of code that's not 'executable' (like a comment)
    • breakpoint condition evals to false


  • marcusafs
    marcusafs Member Posts: 294 Red Ribbon

    The tutorial never says to compile for debug and I assumed the debug run button would do that, like some other tools do.  I compiled for debug and then ran debug and it broke at the break point.

    Thanks.  Maybe someone could add the compile for debug the tutorial.

    ngilbert
  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 8,269 Employee

    That step should definitely be in the lab/tutorial - sorry about that. We're going to be updating all of these for Open World, so I'll make sure this gets included.

    The default compile action in the tool is 'with debug' but we don't auto compile dependent objects with debug on a debug 'start' action - which is what I think you're alluding to.

This discussion has been closed.