将sql放到cursor中,返回Sys_Refcursor类型数据集
解决方案 »
- 求助:关于数据库审计
- 各位大侠帮忙看看下面oracle代码哪错了啊,总说带有编译错误
- vc6 odbc 连接oracle数据库
- 存储过程中动态sql的写法,高分求助~~~--如果需要查找的表明是动态的,那怎么写动态sql
- 高分求错~~~下面的存储过程有错误,请大家来看看是不是逻辑上的错误啊·!!!!100分!!在线等·!!
- 主键用自增还是GUID??
- 在ADO中,怎样判断一个连接,即_ConnectionPtr对象(C++)是否空闲?
- 我想让JOBS暂时的失效几天,而不想删除,该怎么做啊
- 系统使用GHOST还原后无法启动监听,错误信息如下:
- 我是新手,请帮我一把
- Warning:Function created with compilation errors
- 查询缺失旬度日期
(
p_startDate varchar2,
p_endDate varchar2
)
as
p_wfms varchar2(50);
p_province varchar2(5);
p_provinces varchar2(5);
p_subtotal varchar2(5);
p_subtota2 varchar2(5);
p_hpzl varchar2(5);
p_hpzl_xx varchar2(5);
p_total varchar2(5);
cursor cur_a as
select
t.wfms ,w.Province, w.Provinces,(w.Province+Provinces) ,
w.HPZL , HPZL_xx ,(w.HPZL+w.HPZL_xx), (w.Province+Provinces+w.HPZL+w.HPZL_xx)
from
tb_codewfdm t,
(
select
wfxw,
sum(case when jc ='粤' then 1 else 0 end) Province,
sum(case when jc !='粤' then 1 else 0 end) Provinces,
sum(case when HPZL ='16' then 1 else 0 end) HPZL,
sum(case when HPZL ='02' then 1 else 0 end) HPZL_xx
from tb_vio_surveil_bd
where
WFSJ between to_date(p_startDate,'YYYY-MM-DD HH24:MI:SS')
and to_date(p_endDate,'YYYY-MM-DD HH24:MI:SS')
group by wfxw
) w
where t.wfxw=w.wfxw;
begin
open cur_a
loop
feach cur_a
into
p_wfms,p_province ,p_provinces,p_subtotal,p_subtota2,p_hpzl,p_hpzl_xx,p_total ;
exit when cur_a%notfound ;
end loop;
/
你再帮我看一下,我这么放有什么错误?
OPEN CUR_A;
LOOP
FEACH CUR_A
INTO P_WFMS, P_PROVINCE, P_PROVINCES, P_SUBTOTAL, P_SUBTOTA2, P_HPZL, P_HPZL_XX, P_TOTAL;
EXIT WHEN CUR_A%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('输出的内容');
END LOOP;
CLOSE CUR_A;
end;
type cursorType is ref cursor;
end pack_cursor;
/create or replace procedure proc_report
(
p_startDate varchar2,
p_endDate varchar2,
p_Information out pack_cursor.cursorType
)
as
begin
open p_Information for
select
t.wfms ,w.Province, w.Provinces,(w.Province+Provinces) ,
w.HPZL , HPZL_xx ,(w.HPZL+w.HPZL_xx), (w.Province+Provinces+w.HPZL+w.HPZL_xx)
from
tb_codewfdm t,
(
select
wfxw,
sum(case when jc ='粤' then 1 else 0 end) Province,
sum(case when jc !='粤' then 1 else 0 end) Provinces,
sum(case when HPZL ='16' then 1 else 0 end) HPZL,
sum(case when HPZL ='02' then 1 else 0 end) HPZL_xx
from tb_vio_surveil_bd
where
WFSJ between to_date(p_startDate,'YYYY-MM-DD HH24:MI:SS')
and to_date(p_endDate,'YYYY-MM-DD HH24:MI:SS')
group by wfxw
) w
where t.wfxw=w.wfxw;end proc_report;