1
1楼 zyqyour 2007-03-26 10:49:29 create or replace procedure SP_callee(c1 in out sys_refcursor) as v_errm varchar2(256); v int := 100; begin dbms_output.put_line( 'SP_callee run! '); open c1 for select v from sys.dual; exception when others then v_errm := SUBSTR(SQLERRM, 1, 256); DBMS_OUTPUT.PUT_LINE( 'error code=[]: ' || v_errm); dbms_output.put_line( 'SP_callee error! '); end SP_callee; / ------------------------------------------------------------- create or replace procedure SP_caller(c1 in out sys_refcursor) as v_errm varchar2(256); begin dbms_output.put_line( 'SP_caller run! '); sp_callee(c1); exception when others then v_errm := SUBSTR(SQLERRM, 1, 256); DBMS_OUTPUT.PUT_LINE( 'error code=[]: ' || v_errm); dbms_output.put_line( 'SP_caller error! '); end SP_caller; / ------------------------------------------------------------------- set serverout on; declare v_errm varchar2(256); c1 sys_refcursor; v int := 0; begin sp_caller(c1); fetch c1 into v; dbms_output.put_line(v); exception when others then DBMS_OUTPUT.PUT_LINE( 'error ! '); v_errm := SUBSTR(SQLERRM, 1, 256); DBMS_OUTPUT.PUT_LINE( 'error code=[]: ' || v_errm); end; 为什么在SQLPLUS中运行时,得到下面的输出? SP_caller run! SP_callee run! error ! error code=[]:ORA-06504: PL/SQL: Return types of Result Set variables or query do not match PL/SQL procedure successfully completed. 2楼 love_2008 2007-03-26 10:51:46 有什么好奇怪的 怎么了?? 3楼 zyqyour 2007-03-26 10:55:46 为什么会报错啊? c1不是int型的吗?那么“ fetch c1 into v”为什么会报错呢? 4楼 flyarry 2007-03-26 14:21:53 set serverout on; declare v_errm varchar2(256); c1 sys_refcursor; //是这个c1吧,这个cursor是什么样的? v int := 0; 5楼 baojianjun 2007-03-26 14:27:24 c1不是INT类型的而是sys_refcursor类型的 6楼 hongqi162 2007-03-26 14:43:02 很遗憾 我用的是oracle9i 这是我执行后的结果。 SP_caller run! SP_callee run! 100 7楼 hongqi162 2007-03-26 14:44:19 楼主这下该郁闷了 8楼 haisenmai 2007-03-27 19:06:15 期待解决!
搜索墙@2009 www.pkwall.com all rights reserved QQ:276471788 [京ICP备09111534号]
声明:本站部分数据来源于网络,仅供参考,如有版权问题,请联系我们,我们将及时删除!转载本站请注明来源
| |||||