Home » SQL & PL/SQL » Client Tools » Toad debug strange behavior
Toad debug strange behavior [message #682131] Tue, 06 October 2020 06:51 Go to next message
jury68000
Messages: 24
Registered: October 2019
Junior Member
I have a simple procedure:

CREATE OR REPLACE procedure MY.my_temp
is
begin
  for r_list in (
    select first, last, data, city, socnum, count(*) from person
    where 1=1
    and socnum= '112233445566'
    group by first, last, data, city, socnum having count(*) > 1
--select '' first, '' last, '' data, '' city, '' socnum from dual
    loop
		dbms_output.put_line('test: ' || r_list.socnum);
    end loop;
end;
1 - now if in Toad (12.10.0.30) I set a breakpoint at first line (for r_list in) and invoke a debugger and try to go through code line by line (shift-f7) it does not go inside this "for loop" and goes straight to end loop.
2 - when I copy the content of this procedure to sql worksheet and I run the code through f9, I can see the dbms_output.put_line fine
3 - when I comment that select statement and uncomment the
 "select '' first, '' last, '' data, '' city, '' socnum from dual"
and invoke the debugger and go through code line by line, all is OK, I get inside the "for loop" fine

What is going on or what am I missing?

[Updated on: Tue, 06 October 2020 06:53]

Report message to a moderator

Re: Toad debug strange behavior [message #683693 is a reply to message #682131] Sat, 13 February 2021 13:04 Go to previous message
Andrey_R
Messages: 376
Registered: January 2012
Location: Israel
Senior Member

Not sure about Toad, but as far as Oracle PL/Sql synthax, your code is missing a closing bracket , to the least...

SQL>
SQL> set serveroutput on
SQL> Begin
  2  for i in ( select 'some_value' as val from dual )
  3  LOOP
  4  dbms_output.put_line('value is: '|| i.val ) ;
  5  END LOOP;
  6  end;
  7  /
value is: some_value

PL/SQL procedure successfully completed.

SQL>
Previous Topic: How to pass a parameter from PL/Sql block to SQL*Plus
Next Topic: Report output format
Goto Forum:
  


Current Time: Wed Oct 27 02:49:54 CDT 2021