Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bind variable only can take valor one time?

278130Jun 24 2008 — edited Jun 25 2008
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Ă 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2008
Added on Jun 24 2008
1 comment
643 views