用这种形式看怎样
create or replace procedure cj_test is temp_lbillcode varchar2(20):='';
cursor cur_Orders is select lbillcode from orders ;
begin
for v_sor in cur_Orders loop
temp_lbillcode:=v_sor.lbillcode;
end loop;
end cj_test;
create or replace procedure cj_test is temp_lbillcode varchar2(20):='';
cursor cur_Orders is select lbillcode from orders ;
begin
for v_sor in cur_Orders loop
temp_lbillcode:=v_sor.lbillcode;
end loop;
end cj_test;
解决方案 »
- PSpice
- 查询指定时间内所有夜晚的数据?
- oracle中用 pl/sql 处理 LONG RAW 大字段的问题
- 请教not exists 和 not in 的问题!
- oracle8i的数据库恢复,在线等,请各位高手帮忙一下。
- 偶是出学者使用oracle连接服务器时只用过单机的,请问联机时怎么用啊?
- oracle8.05如何使用,不懂,请教,在线急
- 数据库的迁移问题,请大家指教
- bytes、blocks、extents是如何换算的???
- 项目用的oracle数据库,但是要从外部的mysql数据库中的几个表中取数据
- ORACLE里能不能生成长度为6位的随机数 ?
- 急!出现这样的问题Shared memory realm does not exists怎么解决?在线等
我把用来测试存储过程的代码也放出来吧:begin
-- Call the procedure
cj_test;
end;我在pl/sql developer中的sessions窗口中看到有未关闭的游标,为什么?
没有关掉连接的话,当然可以看到游标。
如果你能够确认没有关闭的游标就是这个存储过程产生的话,结论只有一个:那就是
temp_lbillcode varchar2(20):=''; 这个变量定义长度定义小了,才会在fetch的时候产生异常,而你的程序没有捕捉异常,所以游标没有关闭。即使表里面没有记录都不会有异常的。
temp_lbillcode varchar2(20):='';
declare cursor cur_Orders is select lbillcode from orders ;
begin
open cur_Orders;
fetch cur_Orders into temp_lbillcode;
while cur_Orders%found loop
fetch cur_Orders into temp_lbillcode;
end loop;
close cur_Orders;
commit;
exception
when INVALID_CURSOR then
dbms_output.line('Course is error')
when others then
null;
end cj_test;
temp_lbillcode varchar2(20):='';
cursor cur_Orders is select lbillcode from orders ;
begin
open cur_Orders;
fetch cur_Orders into temp_lbillcode;
while cur_Orders%found loop
fetch cur_Orders into temp_lbillcode;
end loop;
close cur_Orders;
commit;
dbms_output.put_line('success');
exception
when INVALID_CURSOR then
dbms_output.put_line('Course is error');
when others then
dbms_output.put_line('error');
end cj_test;结果输出了success,但还是看到有未关闭的游标,这到底是为什么啊!