问两个问题:
(1)、游标是不是必须先定义在包中,然后通过包来调用?
(2)、游标在哪里关闭的?如下:create or replace package test_package as
type test_cursor is ref cursor;
end test_package;create or replace procedure my_sp3(
v_deptno in number,p_cursor out test_package.test_cursor)is
begin
open p_cursor for select * from pme where deptno=v_deptno;
--close p_cursor; 这句如果不注释,java调用时报错,请问一般应在哪里关闭?
end;
(1)、游标是不是必须先定义在包中,然后通过包来调用?
(2)、游标在哪里关闭的?如下:create or replace package test_package as
type test_cursor is ref cursor;
end test_package;create or replace procedure my_sp3(
v_deptno in number,p_cursor out test_package.test_cursor)is
begin
open p_cursor for select * from pme where deptno=v_deptno;
--close p_cursor; 这句如果不注释,java调用时报错,请问一般应在哪里关闭?
end;
p_cursor sys_refcursor;
使用完后关闭游标
open fetch close
在调用里关闭
close p_cursor;
在java中关闭数据集就行了。ResultSet rs;
调用存储过程
rs.close();