There is no problem in oralce 9i. But the version of oracle we are using is 8.17Help me!!!
jlandzpa(jlandzpa) 你推荐的信息我上不去,能不能直接在这贴出来 万分感谢!!!!
这样就可以了: create or replace test as cursor tRefCur(iid number) is select clock, val from tag_value where id = iid; r_c tag_value%clock; r_v tag_value%val; begin open tRefCur(100); fetch tRefCur into r_c, r_v; close tRefCur; exception when others then raise; end test;
我不知道你的参数 (starttime in date, endtime in date)是干什么的,就删了。 你的这种情况,用带参数的光标是最好的,不需要用REF CURSOR
I know statement 'fetch tRefCur into r_c, r_v ' is correct; but I want to use this statement 'fetch tCur bulk collect into r_c, r_v;'The code for the procedure is below.
create or replace test (starttime in date, endtime in date) as type tRefCur IS REF CURSOR; tCur tRefCur; Type cType IS talble of tag_value.clock%TYPE; Type vType IS talble of tag_value.value%TYPE; r_c cType; r_v vType begin open tCur for 'select clock, val from tag_value where id = :i' using 100; fetch tCur bulk collect into r_c, r_v; end test;
http://expert.csdn.net/Expert/topic/982/982672.xml?temp=.3615686
But the version of oracle we are using is 8.17Help me!!!
你推荐的信息我上不去,能不能直接在这贴出来
万分感谢!!!!
create or replace test
as
cursor tRefCur(iid number) is
select clock, val from tag_value where id = iid;
r_c tag_value%clock;
r_v tag_value%val;
begin
open tRefCur(100);
fetch tRefCur into r_c, r_v;
close tRefCur;
exception
when others then
raise;
end test;
(starttime in date, endtime in date)是干什么的,就删了。
你的这种情况,用带参数的光标是最好的,不需要用REF CURSOR
but I want to use this statement
'fetch tCur bulk collect into r_c, r_v;'The code for the procedure is below.
create or replace test (starttime in date, endtime in date)
as
type tRefCur IS REF CURSOR;
tCur tRefCur;
Type cType IS talble of tag_value.clock%TYPE;
Type vType IS talble of tag_value.value%TYPE;
r_c cType;
r_v vType
begin
open tCur for 'select clock, val from tag_value where id = :i' using 100;
fetch tCur bulk collect into r_c, r_v;
end test;
Help me!