忙了一天多的时间,终于搞定这个稍微复杂一点的查询脚本了。
--描述 格式化,预处理,文件入库,分别用上一环节的正常输出文件数和本环节的正常输入文件数进行比对
--格式化
with format as
(select 2000 module_code,'格式化' module_name,a.source_id, (select t.busi_desc from d_src_type_info t where a.source_id=t.source_id) busi_desc,
a.recieve_time,nvl(a.all_record_cnt,0) all_record_cnt, nvl(a.all_file_cnt,0) all_file_cnt,
nvl(b.ok_record_cnt,0) ok_record_cnt,nvl(b.ok_file_cnt,0) ok_file_cnt,
nvl(c.err_record_cnt,0) err_record_cnt,nvl(c.err_file_cnt,0) err_file_cnt,
decode(a.all_record_cnt,(nvl(b.ok_record_cnt,0)+nvl(c.err_record_cnt,0)),'平衡','不平衡') record_balance,
decode(a.all_file_cnt,(nvl(b.ok_file_cnt,0) + nvl(c.err_file_cnt,0)),'平衡','不平衡') file_balance,1 flag
from
(select source_id, substr(recieve_time, 0, 8) recieve_time,
sum(record_count) all_record_cnt,count(*) all_file_cnt from d_sch_format where record_count<>0
group by source_id, substr(recieve_time, 0, 8)) a,
(select source_id, substr(recieve_time, 0, 8) recieve_time,
sum(record_count) ok_record_cnt,count(*) ok_file_cnt from d_sch_format where deal_flag='Y' and record_count<>0
group by source_id, substr(recieve_time, 0, 8)) b,
(select source_id, substr(recieve_time, 0, 8) recieve_time,
sum(record_count) err_record_cnt,count(*) err_file_cnt from d_sch_format where deal_flag='E' and record_count<>0
group by source_id, substr(recieve_time, 0, 8)) c
where a.source_id=b.source_id(+) and a.source_id=c.source_id(+)
and a.recieve_time=b.recieve_time(+) and a.recieve_time=c.recieve_time(+) ) ,
---查询 format表中的file_id在 d_sch_wrtf表中的记录条数
formatWrtf as
(select f2.source_id,f2.recieve_time,f.deal_flag,f.input_count,f.file_id from d_sch_wrtf f,format f2 where
f.file_id in(select file_id from d_sch_format m where m.source_id=f2.source_id and substr(m.recieve_time, 0, 8) =f2.recieve_time and m.record_count<>0)
),
---预处理
wrtf as
(select 2002 module_code,'预处理' module_name,a.source_id, (select t.busi_desc from d_src_type_info t where a.source_id=t.source_id) busi_desc,
a.recieve_time,nvl(a.all_record_cnt,0) all_record_cnt, nvl(a.all_file_cnt,0) all_file_cnt,
nvl(b.ok_record_cnt,0) ok_record_cnt,nvl(b.ok_file_cnt,0) ok_file_cnt,
nvl(c.err_record_cnt,0) err_record_cnt,nvl(c.err_file_cnt,0) err_file_cnt,
decode(a.all_record_cnt,(nvl(b.ok_record_cnt,0)+nvl(c.err_record_cnt,0)),'平衡','不平衡') record_balance,
decode(a.all_file_cnt,(nvl(b.ok_file_cnt,0) + nvl(c.err_file_cnt,0)),'平衡','不平衡') file_balance,2 flag
from
(select f2.source_id,f2.recieve_time,
sum(f2.input_count) all_record_cnt,count(*) all_file_cnt
from formatWrtf f2 group by f2.source_id,f2.recieve_time) a,
(select f2.source_id,f2.recieve_time,
sum(f2.input_count) ok_record_cnt,count(*) ok_file_cnt
from formatWrtf f2 where f2.deal_flag='Y' group by f2.source_id,f2.recieve_time) b,
(select f2.source_id,f2.recieve_time,
sum(f2.input_count) err_record_cnt,count(*) err_file_cnt
from formatWrtf f2 where f2.deal_flag='E' group by f2.source_id,f2.recieve_time) c
where a.source_id=b.source_id(+) and a.source_id=c.source_id(+)
and a.recieve_time=b.recieve_time(+) and a.recieve_time=c.recieve_time(+) ) ,
----文件入库
----即查询d_sch_indb表的file_id在临时表formatWrtf中的记录数
formatIndb as
(
select f2.source_id,f2.recieve_time,f.deal_flag,f.mainflow_count,f.file_id from d_sch_indb f,format f2 where
f.file_id in(select file_id from d_sch_format m where m.source_id=f2.source_id and substr(m.recieve_time, 0, 8) =f2.recieve_time)
),
indb as
(select 2004 module_code,'文件入库' module_name,a.source_id, (select t.busi_desc from d_src_type_info t where a.source_id=t.source_id) busi_desc,
a.recieve_time,nvl(a.all_record_cnt,0) all_record_cnt, nvl(a.all_file_cnt,0) all_file_cnt,
nvl(b.ok_record_cnt,0) ok_record_cnt,nvl(b.ok_file_cnt,0) ok_file_cnt,
nvl(c.err_record_cnt,0) err_record_cnt,nvl(c.err_file_cnt,0) err_file_cnt,
decode(a.all_record_cnt,(nvl(b.ok_record_cnt,0)+nvl(c.err_record_cnt,0)),'平衡','不平衡') record_balance,
decode(a.all_file_cnt,(nvl(b.ok_file_cnt,0) + nvl(c.err_file_cnt,0)),'平衡','不平衡') file_balance,3 flag
from
(select f2.source_id,f2.recieve_time,
sum(f2.mainflow_count) all_record_cnt,count(*) all_file_cnt
from formatIndb f2 group by f2.source_id,f2.recieve_time) a,
(select f2.source_id,f2.recieve_time,
sum(f2.mainflow_count) ok_record_cnt,count(*) ok_file_cnt
from formatIndb f2 where f2.deal_flag='Y' group by f2.source_id,f2.recieve_time) b,
(select f2.source_id,f2.recieve_time,
sum(f2.mainflow_count) err_record_cnt,count(*) err_file_cnt
from formatIndb f2 where f2.deal_flag='E' group by f2.source_id,f2.recieve_time) c
where a.source_id=b.source_id(+) and a.source_id=c.source_id(+)
and a.recieve_time=b.recieve_time(+) and a.recieve_time=c.recieve_time(+) ),
/*
temprow as
(
select 2006 module_code,' ' module_name,a.source_id, ' ' busi_desc,
a.recieve_time,
null all_record_cnt,
null all_file_cnt,
null ok_file_cnt,
null ok_record_cnt,
null err_file_cnt,
null err_record_cnt,
null record_balance,
null file_balance,
4 flag
from indb a
), */
tempView as
(
select * from (
select * from format
union all
select
w.module_code,
w.module_name,
w.source_id,
w.busi_desc,
w.recieve_time,
w.all_record_cnt,
w.all_file_cnt,
w.ok_record_cnt,
w.ok_file_cnt,
w.err_record_cnt,
w.err_file_cnt,
decode(w.all_record_cnt,f.ok_record_cnt,'平衡','不平衡') record_balance,
decode(w.all_file_cnt,f.ok_file_cnt,'平衡','不平衡') file_balance,
w.flag
from wrtf w,format f where w.source_id=f.source_id and w.recieve_time=f.recieve_time
union all
select
d.module_code,
d.module_name,
d.source_id,
d.busi_desc,
d.recieve_time,
d.all_record_cnt,
d.all_file_cnt,
d.ok_record_cnt,
d.ok_file_cnt,
d.err_record_cnt,
d.err_file_cnt,
decode(d.all_record_cnt,f.ok_record_cnt,'平衡','不平衡') record_balance,
decode(d.all_file_cnt,f.ok_file_cnt,'平衡','不平衡') file_balance,
d.flag
from indb d, wrtf f where d.source_id=f.source_id and d.recieve_time=f.recieve_time ) c
)
select source_id,
busi_desc,
module_name,
recieve_time file_name,
all_record_cnt in_record_cnt,
ok_record_cnt,
err_record_cnt,
all_file_cnt in_file_cnt,
ok_file_cnt,
err_file_cnt,
record_balance,
file_balance,
flag
from tempView order by recieve_time, source_id, flag;
. eshore.
相关推荐
大数据预处理技术---- 预处理大数据预处理技术
数据预处理-归一化-数据文件
使用spm12工具对NIFTI文件进行归一化,输出w开头文件。该步骤需要修改Voxel sizes参数。 步骤6:平滑 使用spm12工具对NIFTI文件进行平滑,输出sw开头文件。该步骤需要修改default smooth参数。 步骤7:配准 使用...
python数据处理常用代码---数据预处理,包含博客里的所有代码,共大家练习使用。 python数据处理常用代码---数据预处理,包含博客里的所有代码,共大家练习使用。 python数据处理常用代码---数据预处理,包含博客里...
预处理脚本,从 raw_user.csv 中提取前 10 万条记录,小数据集中包含 id、user_id、 item_id、behavior_type、date、province 等 6 列数据,各字段值之间用\t(占位符)隔开, 小数据集中不包含字段名
文章:python------数据预处理与特征工程系列用到的数据集。 digit recognizor.csv Narrativedata.csv
蒙古文语料预处理流程 校正人工标注实体边界误差 python correctBoundary.py 和一些人工校对 ...语料的相应预处理操作,准备实验所需文件,如:5折交叉验证数据集,词表,词向量表等 python corpusPrepr
数据挖掘实验报告-数据预处理.pdf数据挖掘实验报告-数据预处理.pdf数据挖掘实验报告-数据预处理.pdf数据挖掘实验报告-数据预处理.pdf数据挖掘实验报告-数据预处理.pdf数据挖掘实验报告-数据预处理.pdf数据挖掘实验...
文件用于mmdetection3d的SUN RGB-D数据集预处理程序,原始处理程序为matlab版,这里替换成了Python版本。文件包含了数据集分割和标注数据提取两个python脚本文件。具体使用方法请参考本人即将更新的博客:...
基于表面的rs-fMRI预处理脚本,用于从原始粗体时间序列和T1w图像中提取静止状态功能连接(RSFC)矩阵。 要求 FreeSurfer Connectome工作台 空军情报局 具有MSM(多峰表面匹配)的FSL 筛选 在具有多个库的python 3...
ACE2005事件抽取数据预处理工作是指,根据原始的.apf.xml和.sgm文件,提取与事件有关的要素(sentence,trigger,argument及trigger和argument在原文中的offset),并通过StandfordCoreNLP对sentence进行词性和句法依赖...
在eeglab预处理脑电信号中,需要定位电极,改文件包含电极定位文件,电极定位为预处理必须操作。
人工智能-项目实践-数据预处理
Illegal initialization ------------------非法的初始化 Illegal octal digit ------------------非法的8进制数字 houjiuming Illegal pointer subtraction ------------------非法的指针相减 Illegal structure...
关于对哨兵二号预处理。
YOLOV5安全帽检测数据集-yolo格式-voc格式YOLOV5安全帽检测数据集-yolo格式-voc格式YOLOV5安全帽检测数据集-yolo格式-voc格式YOLOV5安全帽检测数据集-yolo格式-voc格式YOLOV5安全帽检测数据集-yolo格式-voc格式YOLOV...
人脸识别、表情识别图像预处理--图像库人脸图像剪切、旋转
1、资源内容:用于深度学习(ultralytics-Yolo训练)数据集文件整合与预处理小工具+界面截图+源代码+文档说明 2、代码特点:内含运行结果,不会运行可私信,参数化编程、参数可方便更改、代码编程思路清晰、注释明细...
一些用于图像预处理的代码 主要用python和opencv实现,包括图像的裁剪、切割、合并。 还有一些对图像标注文件的处理,包括图像标注文件可视化、转化成灰度mask、二值mask、coco格式等。
福建师范大学精品大数据导论课程系列 (4.3.1)--3.3 《大数据预处理》课件PPT.pdf 福建师范大学精品大数据导论课程系列 (4.4.1)--3.4 《大数据集成》课件PPT.pdf 福建师范大学精品大数据导论课程系列 (5.1.1)--4.1.1 ...