将sql放到cursor中,返回Sys_Refcursor类型数据集
解决方案 »
- 怎样使oracle每次启动自动执行一个自定义sql语句
- 存储过程的循环中有sql就出错误。
- 请帮助写一个很简单的ORACLE语句
- hibernate 问题 求大神解决。
- linux系统安装的oracle数据库忘记密码
- 安装oracle8.17时出现" 写入文件:d:\oracle\ora81\jis\lib\full_orb.jar时出现错误,"
- 如果imp做full导入的时候用ignore=y参数,会不会对数据字典的表进行insert??造成数据字典的表的数据造成重复
- 请问如何以任意单位取出2个日期之间的间隔
- windows2003中安装ORACLE9I
- 请问那位朋友有严蔚敏的那本数据结构的C语言版的pdf格式的清晰文档,能给我一份吗,万分感激!
- 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;