用这种形式看怎样
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;
解决方案 »
- 请求帮助,现在一个orcal库里的表中的数据,要如何实现推送另外一个数据库里的表里,求思路
- iSQL*Plus command问题
- 用sql语句如何得到这样结果?
- insert into 表(字段) select 字段 from 表,出现ORA-00997: illegal use of LONG datatype
- 如何删除同时多张表?
- Win2K中的MSDAORA.1连接到oracle的驱动丢失,请问如何重新安装?
- Oracle中存照片用什么格式好?
- qfsb_p(我心飞翔)进来接分
- 紧急求解:下面几个SQL语句能否合并成一条语句
- 关于回滚段的问题,在线等待
- 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,但还是看到有未关闭的游标,这到底是为什么啊!