create global temporary TABLE acc_tp
(
Fid NUMBER(19) --单据内码
,FbillNo NVARCHAR2(30) --单据编号
,F_YL_Year NUMBER(10) --年份
,F_YL_PromotionType NUMBER(10) --方案类型
,F_YL_PromotionNo NVARCHAR2(50) --方案编号
,FCostDeptID NUMBER(10) --应用区域(部门内码)
,FDeptNameID NUMBER(10) --费用承担单位(部门内码)
,F_YL_BeginExeDate DATE --执行开始时间
,F_YL_EndExeDate DATE --执行结束时间
,ForgAmount NUMBER(23,10) --申请金额
,F_YL_CloseStatus CHAR(1) --结案状态
,FDocumentStatus CHAR(1) --单据状态
)
on commit preserve rows;
Insert Into acc_tp
(
Fid
,FbillNo
,F_YL_Year
,F_YL_PromotionType
,F_YL_PromotionNo
,FCostDeptID
,FDeptNameID
,F_YL_BeginExeDate
,F_YL_EndExeDate
,ForgAmount
,F_YL_CloseStatus
,FDocumentStatus
)
select a1.fid,a1.fbillno,a1.F_YL_Year, '总案支' F_YL_PromotionType,a1.F_YL_PromotionNo,a1.FCOSTDEPTID,a1.FDEPTID,a1.F_YL_BEGINEXEDATE,a1.F_YL_ENDEXEDATE
,sum(a2.ForgAmount) ForgAmount,a1.F_YL_CLOSESTATUS,a1.FDOCUMENTSTATUS
from YL_T_ER_ExpenseReq a1,YL_T_ER_ExpenseReq_E1 a2,YL_T_ER_Advance_E1_Lk a3
where a1.fid=a2.fid and a1.fid=a3.fsbillid and a1.F_YL_Year>=2015
group by a1.fid,a1.fbillno,F_YL_Year,F_YL_PromotionNo,FCOSTDEPTID,FDEPTID,F_YL_BEGINEXEDATE,F_YL_ENDEXEDATE,F_YL_CLOSESTATUS,FDOCUMENTSTATUS
order by a1.F_YL_PromotionNo
提示:ORA-01722无效数字 错误
|
-
表结构
|