Can you help me about the different results in "SQL Developer" and "SQL*Plus" with bind variable's management?
I execute next code. My table emp have 14 records.
var n_fetch number;
var n_rowcount number;
declare
cursor S is
select emp_no from emp;
v_emp_no emp.emp_no%type;
begin
:n_fetch := 0; -- (1)
open S;
fetch S into v_emp_no;
while S%found loop
:n_fetch := :n_fetch + 1;
fetch S into v_emp_no;
end loop;
:n_rowcount := S%rowcount;
close S;
end;
/
print n_fetch n_rowcount
In SQL*Plus, the result is:
N_FETCH
----------
14
N_ROWCOUNT
----------
14
In SQL Developer, the result is:
n_fetch
-
0
n_rowcount
--
14
If I change instruction (1) for: :n_fetch := 100;
then, in SQL*Plus the result is correct (n_fetch=114 and n_rowcount=14) but in SQL Developer, attention, the result is:
n_fetch
-
100
n_rowcount
--
14
Conclusion: Bind variable only can take valor one time !!!
What happen's in SQL Developer? I work with Oracle SQL Developer 1.5.1.
Thanks, very much
Isidre GuixĂ