why i can't stop my pl/sql program at breakpoint which i set in TOAD
Question
i have a simple oracle stored procedure proc1 as follows:
CREATE OR REPLACE PROCEDURE SYS.proc1
IS
total NUMBER := 0;
temp INTEGER := 0;
BEGIN
FOR i IN 1 .. 5
LOOP
temp := 2 * i;
total := total + temp;
END LOOP;
DBMS_OUTPUT.put_line (total);
END;
the owner of proc1 is sys. sys have enough privileges to debug proc1 as the follow sql command shows:
SELECT *
FROM session_privs
WHERE privilege LIKE '%DEBUG%';
i'll get the following result:
DEBUG CONNECT SESSION
DEBUG ANY PROCEDURE
i use oracle 11g as the following sql commands shows:
SELECT * FROM v$database;
SELECT * FROM v$instance;
the upper queries gives me:
1223277241,ORCL,8/21/2009 5:28:25 PM,886308,8/21/2009 5:28:28 PM,1,10/15/2007 10:08:59 AM,NOARCHIVELOG,3510666,3399439,CURRENT,8/21/2009 5:28:26 PM,10008,3536169,11/10/2009 3:16:51 PM,NOT ALLOWED,8/21/2009 5:28:25 PM,READ WRITE,MAXIMUM PERFORMANCE,UNPROTECTED,ENABLED,1223308473,1223308473,PRIMARY,886308,DISABLED,SESSIONS ACTIVE,DISABLED,NONE,NO,NO,NO,NO,7,Microsoft Windows IA (32-bit),2,2,3536339,NO,NO,NO,orcl,0,DISABLED,,0,,,NO,,NO,
and
1,orcl,WD00070136,11.1.0.6.0,11/9/2009 11:04:29 AM,OPEN,NO,1,STOPPED,,ALLOWED,NO,ACTIVE,PRIMARY_INSTANCE,NORMAL,NO
in TOAD, i set breakpoint at proc1, then i click the "execute the plsql with debugger" button. TOAD run proc1 and display the result immediately. It just does not stop at breakpoint. I don't know why. Does anybody ever run into this problem? how do you fix it? Great thanks!
ps: i use toad 9.7.2
Solution
Where exactly do you put your breakpoint? I hope you don't put it on the CREATE PROCEDURE
line.
If you put it on that like, it doesn't work (that statement only creates the procedure, it doesn't execute it). You have to call proc1 from somewhere and put the breakpoint on the line where it is called, like this:
BEGIN
proc1; -- place your breakpoint on this line
END;