oracle

推荐列表 站点导航

当前位置:首页 > 数据库 > oracle >

Oracle 查询存储过程做横向报表的方法

来源:网络整理  作者:  发布时间:2020-12-14 14:59
Oracle 查询存储过程做横向报表的方法,需要的朋友可以参考一下...
t14 as t14 ,
/* 创建日期 姓名 */
-- 删除:根据ID删除刚刚插入的记录
max(case when b.term_type='T21' then b.c else 0 end) as T21,
t4M ,
(

包的定义声明:

group by a.term_type, a.biz_id
max(case when b.term_type='T14' then b.c else 0 end) as T14,
o_cursor OUT bulletin_report_type)
BEGIN
tCount as tCount,
set_id_bulletin_report_temp as id_bulletin_report_temp,
t07 ,

复制代码 代码如下:

t21 ,
report.biz_id,
/* 参数说明: */
max(case when b.term_type='T2M' then b.c else 0 end) as T2M,
delete from scms_bulletin_report_temp temp where temp.id_bulletin_report_temp = set_id_bulletin_report_temp;
t01 as t01 ,
max(case when b.term_type='T07' then b.c else 0 end) as T07,
select c.*,
scms_capital_dynamic_manage manager
scms_capital_assign_detail detail,
max(case when b.term_type='T2Y' then b.c else 0 end) as T2Y,
report.biz_id,
from
select
commit;
and detail.id_capital_dynamic_manage = i_id_capital_dynamic_manage
t6M as t6M ,
t6M ,
/* 创建日期 姓名 */

'总计(天数)' as biz_Name,
scms_common_packge.get_biz_name(b.biz_id) as biz_Name,
)
) a
t01 ,
t2M ,

PROCEDURE p_list_bulletin_report( i_id_capital_dynamic_manage IN VARCHAR2,
t2M ,
from(
insert into scms_bulletin_report_temp

PROCEDURE p_list_bulletin_report( i_id_capital_dynamic_manage IN VARCHAR2,
order by sortNo asc;
t14 ,

因为要牵扯到小计,所以需要计算两次。

where manager.id_capital_dynamic_manage = detail.id_capital_dynamic_manage

/************************************************************************************/
detail.term_type
(
)
max(case when b.term_type='T3M' then b.c else 0 end) as T3M,
max(case when b.term_type='T21' then b.c else 0 end) as T21,
/* */
t4M as t4M ,
sort_no as sortNo


想法:

and manager.IS_CONFIRM = '1'

set_id_bulletin_report_temp as id_bulletin_report_temp,
select
t1M ,

3、查询临时表记录放置到游标中。

max(case when b.term_type='T4M' then b.c else 0 end) as T4M,
CREATE OR REPLACE PACKAGE BODY CHEN_TEST_PACKGE IS

max(case when b.term_type='T14' then b.c else 0 end) as T14,
/************************************************************************************/

1、把查询到的结果,插入到临时表,

select a.term_type,'biz_id_count' as biz_id, sum(a.capital_claim) c
/* i_id_capital_dynamic_manage IN VARCHAR2 某种公告ID */

2、把统计结果插入到临时表。

t21 as t21 ,
) c;
sort_no
/* o_cursor OUT bulletin_report_type 返回游标 */
/* */
/* 2013-03-08 路人甲 */
/* 参数说明: */
END p_list_bulletin_report;
t1M as t1M ,

复制代码 代码如下:

--select to_char(sysdate,'yyyymmddhh24missSSS') into set_id_bulletin_report_temp from dual;
and report.id_capital_assign_detail = detail.id_capital_assign_detail
tCount ,
END CHEN_TEST_PACKGE;
max(case when b.term_type='T4M' then b.c else 0 end) as T4M,
from scms_capital_claim_report report,
where manager.id_capital_dynamic_manage = detail.id_capital_dynamic_manage
max(case when b.term_type='T1Y' then b.c else 0 end) as T1Y,
max(case when b.term_type='T5M' then b.c else 0 end) as T5M,
set_id_bulletin_report_temp VARCHAR2(50); -- 定义临时变量
t2M as t2M ,
id_bulletin_report_temp,
/
insert into scms_bulletin_report_temp
/* 2013-03-08 路人甲 */
max(case when b.term_type='T6M' then b.c else 0 end) as T6M,

CREATE OR REPLACE PACKAGE CHEN_TEST_PACKGE IS
max(case when b.term_type='T1M' then b.c else 0 end) as T1M,
from (select report.capital_claim,
open o_cursor for
biz_Name as bizName ,
--给临时变量赋值
(select max(sort_no)+1 from scms_bulletin_report_temp te where te.id_bulletin_report_temp = set_id_bulletin_report_temp ) as sort_no
select c.*,

4、删除临时表记录。

detail.term_type


where temp.id_bulletin_report_temp = set_id_bulletin_report_temp
group by a.term_type
max(case when b.term_type='T2M' then b.c else 0 end) as T2M,
max(case when b.term_type='T01' then b.c else 0 end) as T01,
/* 功能说明:查询某种公告报表 */
t1Y ,
t2Y ,
t3M as t3M ,
max(case when b.term_type='T07' then b.c else 0 end) as T07,
max(case when b.term_type='T1Y' then b.c else 0 end) as T1Y,
/* i_id_capital_dynamic_manage IN VARCHAR2 某种公告ID */
max(case when b.term_type='T1M' then b.c else 0 end) as T1M,

/************************************************************************************/
) c;
sort_no
/* 功能说明:查询某种公告报表 */
(
t5M ,
(
from(
o_cursor OUT cursor_type);

sum(b.c) as BIZ_ID_COUNT
from scms_bulletin_report_temp temp
t1M ,
from
id_bulletin_report_temp,
AS
t01 ,
scms_capital_assign_detail detail,

-- 插入总记录数

END CHEN_TEST_PACKGE;
tCount ,
from (select report.capital_claim,
biz_Name ,
max(case when b.term_type='T3M' then b.c else 0 end) as T3M,
/************************************************************************************/

t5M as t5M ,
scms_capital_dynamic_manage manager
-- 查询刚刚插入的表记录
t07 as t07 ,
--获取数据插入临时表
) b group by b.biz_id
) a
and manager.IS_CONFIRM = '1'
type cursor_type is ref cursor;

t3M ,
max(case when b.term_type='T6M' then b.c else 0 end) as T6M,
t2Y ,
and manager.IS_SETTLEMENT = '1'
sum(b.c) as BIZ_ID_COUNT
t1Y as t1Y ,

/* o_cursor OUT cursor_type 返回游标 */
from scms_capital_claim_report report,
begin
t1Y ,
and detail.id_capital_dynamic_manage = i_id_capital_dynamic_manage
t14 ,
页面调用ibatis的xml配置查询结果:

t2Y as t2Y ,
select
max(case when b.term_type='T01' then b.c else 0 end) as T01,
t21 ,
and manager.IS_SETTLEMENT = '1'
) b group by b.biz_id
id_bulletin_report_temp as idBulletinReportTemp,
t5M ,
select i_id_capital_dynamic_manage into set_id_bulletin_report_temp from dual;
t3M ,

复制代码 代码如下:

end;
t4M ,
t07 ,
biz_Name ,

t6M ,

包的实现:

rownum as sort_no
max(case when b.term_type='T5M' then b.c else 0 end) as T5M,
select a.term_type,a.biz_id, sum(a.capital_claim) c
max(case when b.term_type='T2Y' then b.c else 0 end) as T2Y,
and report.id_capital_assign_detail = detail.id_capital_assign_detail

相关热词: oracle 方法

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/sql/oracle/3809.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

Oracle 查询存储过程做横向报表的方法

2020-12-14 编辑:

t14 as t14 ,
/* 创建日期 姓名 */
-- 删除:根据ID删除刚刚插入的记录
max(case when b.term_type='T21' then b.c else 0 end) as T21,
t4M ,
(

包的定义声明:

group by a.term_type, a.biz_id
max(case when b.term_type='T14' then b.c else 0 end) as T14,
o_cursor OUT bulletin_report_type)
BEGIN
tCount as tCount,
set_id_bulletin_report_temp as id_bulletin_report_temp,
t07 ,

复制代码 代码如下:

t21 ,
report.biz_id,
/* 参数说明: */
max(case when b.term_type='T2M' then b.c else 0 end) as T2M,
delete from scms_bulletin_report_temp temp where temp.id_bulletin_report_temp = set_id_bulletin_report_temp;
t01 as t01 ,
max(case when b.term_type='T07' then b.c else 0 end) as T07,
select c.*,
scms_capital_dynamic_manage manager
scms_capital_assign_detail detail,
max(case when b.term_type='T2Y' then b.c else 0 end) as T2Y,
report.biz_id,
from
select
commit;
and detail.id_capital_dynamic_manage = i_id_capital_dynamic_manage
t6M as t6M ,
t6M ,
/* 创建日期 姓名 */

'总计(天数)' as biz_Name,
scms_common_packge.get_biz_name(b.biz_id) as biz_Name,
)
) a
t01 ,
t2M ,

PROCEDURE p_list_bulletin_report( i_id_capital_dynamic_manage IN VARCHAR2,
t2M ,
from(
insert into scms_bulletin_report_temp

PROCEDURE p_list_bulletin_report( i_id_capital_dynamic_manage IN VARCHAR2,
order by sortNo asc;
t14 ,

因为要牵扯到小计,所以需要计算两次。

where manager.id_capital_dynamic_manage = detail.id_capital_dynamic_manage

/************************************************************************************/
detail.term_type
(
)
max(case when b.term_type='T3M' then b.c else 0 end) as T3M,
max(case when b.term_type='T21' then b.c else 0 end) as T21,
/* */
t4M as t4M ,
sort_no as sortNo


想法:

and manager.IS_CONFIRM = '1'

set_id_bulletin_report_temp as id_bulletin_report_temp,
select
t1M ,

3、查询临时表记录放置到游标中。

max(case when b.term_type='T4M' then b.c else 0 end) as T4M,
CREATE OR REPLACE PACKAGE BODY CHEN_TEST_PACKGE IS

max(case when b.term_type='T14' then b.c else 0 end) as T14,
/************************************************************************************/

1、把查询到的结果,插入到临时表,

select a.term_type,'biz_id_count' as biz_id, sum(a.capital_claim) c
/* i_id_capital_dynamic_manage IN VARCHAR2 某种公告ID */

2、把统计结果插入到临时表。

t21 as t21 ,
) c;
sort_no
/* o_cursor OUT bulletin_report_type 返回游标 */
/* */
/* 2013-03-08 路人甲 */
/* 参数说明: */
END p_list_bulletin_report;
t1M as t1M ,

复制代码 代码如下:

--select to_char(sysdate,'yyyymmddhh24missSSS') into set_id_bulletin_report_temp from dual;
and report.id_capital_assign_detail = detail.id_capital_assign_detail
tCount ,
END CHEN_TEST_PACKGE;
max(case when b.term_type='T4M' then b.c else 0 end) as T4M,
from scms_capital_claim_report report,
where manager.id_capital_dynamic_manage = detail.id_capital_dynamic_manage
max(case when b.term_type='T1Y' then b.c else 0 end) as T1Y,
max(case when b.term_type='T5M' then b.c else 0 end) as T5M,
set_id_bulletin_report_temp VARCHAR2(50); -- 定义临时变量
t2M as t2M ,
id_bulletin_report_temp,
/
insert into scms_bulletin_report_temp
/* 2013-03-08 路人甲 */
max(case when b.term_type='T6M' then b.c else 0 end) as T6M,

CREATE OR REPLACE PACKAGE CHEN_TEST_PACKGE IS
max(case when b.term_type='T1M' then b.c else 0 end) as T1M,
from (select report.capital_claim,
open o_cursor for
biz_Name as bizName ,
--给临时变量赋值
(select max(sort_no)+1 from scms_bulletin_report_temp te where te.id_bulletin_report_temp = set_id_bulletin_report_temp ) as sort_no
select c.*,

4、删除临时表记录。

detail.term_type


where temp.id_bulletin_report_temp = set_id_bulletin_report_temp
group by a.term_type
max(case when b.term_type='T2M' then b.c else 0 end) as T2M,
max(case when b.term_type='T01' then b.c else 0 end) as T01,
/* 功能说明:查询某种公告报表 */
t1Y ,
t2Y ,
t3M as t3M ,
max(case when b.term_type='T07' then b.c else 0 end) as T07,
max(case when b.term_type='T1Y' then b.c else 0 end) as T1Y,
/* i_id_capital_dynamic_manage IN VARCHAR2 某种公告ID */
max(case when b.term_type='T1M' then b.c else 0 end) as T1M,

/************************************************************************************/
) c;
sort_no
/* 功能说明:查询某种公告报表 */
(
t5M ,
(
from(
o_cursor OUT cursor_type);

sum(b.c) as BIZ_ID_COUNT
from scms_bulletin_report_temp temp
t1M ,
from
id_bulletin_report_temp,
AS
t01 ,
scms_capital_assign_detail detail,

-- 插入总记录数

END CHEN_TEST_PACKGE;
tCount ,
from (select report.capital_claim,
biz_Name ,
max(case when b.term_type='T3M' then b.c else 0 end) as T3M,
/************************************************************************************/

t5M as t5M ,
scms_capital_dynamic_manage manager
-- 查询刚刚插入的表记录
t07 as t07 ,
--获取数据插入临时表
) b group by b.biz_id
) a
and manager.IS_CONFIRM = '1'
type cursor_type is ref cursor;

t3M ,
max(case when b.term_type='T6M' then b.c else 0 end) as T6M,
t2Y ,
and manager.IS_SETTLEMENT = '1'
sum(b.c) as BIZ_ID_COUNT
t1Y as t1Y ,

/* o_cursor OUT cursor_type 返回游标 */
from scms_capital_claim_report report,
begin
t1Y ,
and detail.id_capital_dynamic_manage = i_id_capital_dynamic_manage
t14 ,
页面调用ibatis的xml配置查询结果:

t2Y as t2Y ,
select
max(case when b.term_type='T01' then b.c else 0 end) as T01,
t21 ,
and manager.IS_SETTLEMENT = '1'
) b group by b.biz_id
id_bulletin_report_temp as idBulletinReportTemp,
t5M ,
select i_id_capital_dynamic_manage into set_id_bulletin_report_temp from dual;
t3M ,

复制代码 代码如下:

end;
t4M ,
t07 ,
biz_Name ,

t6M ,

包的实现:

rownum as sort_no
max(case when b.term_type='T5M' then b.c else 0 end) as T5M,
select a.term_type,a.biz_id, sum(a.capital_claim) c
max(case when b.term_type='T2Y' then b.c else 0 end) as T2Y,
and report.id_capital_assign_detail = detail.id_capital_assign_detail

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/sql/oracle/3809.shtml

相关文章

风云图片

推荐阅读

返回oracle频道首页