小弟新手,哪位高手帮帮忙,跪求........
存储过程A如下:
create or replace procedure p_fn_inv_detail_basic_rpt
(
V_CUST_CARRIER_CD in varchar2, --客户代码
V_STTLMONTH in varchar2, --账期
V_BIZ_PKG in int,
V_PRODUCT_CD in int, --表示全部99
r_dataset out pubdba.Pub_Pack.t_retdataset
)
as
icount integer;
begin
if (V_PRODUCT_CD=1 or V_PRODUCT_CD=99) then
select count(*) into icount from incdba.service_fee_detail_temp ;
if(icount>0) then
--返回结果集
open r_dataset for
select a.groupname ,
a.tap_rap_file_nm tap_file_nm,
nvl(a.cdr_sum_count, 0) cdr_sum_count,
a.tap_rap_db_insr_tm tap_db_insr_tm
from (select p.* from incdba.service_fee_detail_temp p where burl_type=1 and p.cust_carrier_cd=V_CUST_CARRIER_CD order by p.tap_rap_file_nm,p.partner_carrier_cd) a;
else --icount=0
open r_dataset for
select null groupname ,
null tap_file_nm,
null cdr_sum_count,
null tap_db_insr_tm
from dual where 1<>1;
end if;
else --V_PRODUCT_CD<>1or99
open r_dataset for
select null groupname ,
null tap_file_nm,
null cdr_sum_count,
null tap_db_insr_tm
from dual where 1<>1;
end if;
return;
exception
--其他标准异常
when others then
return;
end p_fn_inv_detail_basic_rpt;
我要在存储过程B中获取A返回的总记录数
create or replace procedure P_FN_INV_DETAIL_OVERALL_RPT
(--Overall节
V_CUST_CARRIER_CD in varchar2, --客户代码
V_STTLMONTH in varchar2, --账期
V_BIZ_PKG in int,
V_PRODUCT_CD in int,
r_dataset out pubdba.Pub_Pack.t_retdataset
)
as
begin
我这里该如何做?这里有多个存储过程,只要获得每个存储过程的总行数,其他什么都不要
return;
exception
--其他标准异常
when others then
return;
end P_FN_INV_DETAIL_OVERALL_RPT;
------解决思路----------------------
给个demo
返回游标的存储过程
create or replace procedure p_test_1(cur out sys_refcursor)
as
begin
open cur for select empno,ename from scott.emp;
end;
/
统计行数
declare
type tp1 is record(c1 number(4),c2 varchar2(10));
type tp2 is table of tp1 index by binary_integer;
tp_inst tp2;
v_cur sys_refcursor;
begin
p_test_1(v_cur);
--将游标中的记录取到数组中
fetch v_cur bulk collect into tp_inst;
--取完以后,查看游标取到第几行,就知道记录数了
dbms_output.put_line(v_cur%rowcount);
--或者,可以通过统计数组中的元素个数来得出
dbms_output.put_line(tp_inst.count);
close v_cur;
end;