spool file

-----------genhccappl.sql--------------

drop table tbl_maprg_inap_appl_tmp1 ;
drop table tbl_maprg_inap_appl_tmp2 ;
drop table tbl_maprg_inap_card_tmp1 ;
drop table tbl_maprg_inap_card_tmp2 ;

CREATE TABLE tbl_maprg_inap_appl_tmp1
TABLESPACE TBS_MAPG_TEMP_OBJS
NOLOGGING
PCTFREE 0
AS
(
 SELECT appl_ref AS appl_ref,
        Max(ver_dte) AS ver_dte
 FROM tbl_maprb_hcc_appl_appl
 GROUP BY appl_ref
);

CREATE TABLE tbl_maprg_inap_appl_tmp2
TABLESPACE TBS_MAPG_TEMP_OBJS
NOLOGGING
PCTFREE 0
AS
(
 SELECT a.*
 FROM tbl_maprb_hcc_appl_appl a,
      tbl_maprg_inap_appl_tmp1 b
 WHERE  a.appl_ref = b.appl_ref
 AND    a.ver_dte = b.ver_dte
);

CREATE TABLE tbl_maprg_inap_card_tmp1
TABLESPACE TBS_MAPG_TEMP_OBJS
NOLOGGING
PCTFREE 0
AS
(
 SELECT appl_ref AS appl_ref,
        Max(ver_dte) AS ver_dte
 FROM tbl_maprb_hcc_appl_card
 GROUP BY appl_ref
);

CREATE TABLE tbl_maprg_inap_card_tmp2
TABLESPACE TBS_MAPG_TEMP_OBJS
NOLOGGING
PCTFREE 0
AS
(
 SELECT a.*
 FROM tbl_maprb_hcc_appl_card  a,
      tbl_maprg_inap_card_tmp1 b
 WHERE  a.appl_ref = b.appl_ref
 AND    a.ver_dte = b.ver_dte
);

 

 

SET termout OFF
SET pause OFF
SET echo OFF
SET timing OFF
SET verify OFF
SET feedback OFF
SET heading OFF
SET newpage NONE
SET linesize 133


spool hccappl.dat

SELECT distinct  RPad(nvl(To_Char(appl.VER_DTE,'yyyymmdd'),' '),8,' ')
       ||RPad(nvl(appl.APPL_REF,' '),12,' ')
       ||RPad(nvl(appl.APPL_STUS,' '),2,' ')
       ||RPad(nvl(appl.SRC_OF_APPL,' '),4,' ')
       ||RPad(nvl(appl.PRIM_APPL_CUS_ID_TYP,' '),1,' ')
       ||RPad(nvl(appl.PRIM_APPL_CUS_ID,' '),12,' ')
       ||RPad(nvl(To_Char(appl.APPL_RECV_DTE,'YYYYMMDD'),' '),8,' ')
       ||RPad(nvl(To_Char(appl.APPL_STUS_SET_DTE,'YYYYMMDD'),' '),8,' ')
       ||RPad(nvl(appl.SALE_FORCE_ID,' '),10,' ')
       ||RPad(nvl(To_Char(acbal.CD_CLOS_DTE,'YYYYMMDD'),' '),8,' ')      
       ||RPad(nvl(to_char(acbal.CD_CR_LMT_HKE,'FM0999999999999.00'),'0000000000000.00'),16,' ')
       ||RPad(nvl(cd.FNL_DCSN,' '),2,' ')
       ||RPad(nvl(acbal.RECR_PGM_CDE,' '),4,' ')
       ||RPad(nvl(acbal.CD_PROD_TYP,' '),3,' ')
       ||RPad(nvl(appl.CD_COMB_ID,' '),4,' ') 
       ||RPad(nvl(cd.PLAS_ID,' '),3,' ')  
       ||RPad(nvl(acbal.CD_NO,' '),16,' ')
       ||RPad(nvl(acbal.HUB_AC_NO,' '),12,' ')
from (select * from TBL_MAPRB_HCC_ACBAL_DP 
      where ver_dte = (select max(ver_dte) from Tbl_maprb_hcc_acbal_dp)) acbal,
     tbl_maprg_inap_appl_tmp2 appl, tbl_maprg_inap_card_tmp2 cd
where appl.appl_Ref = cd.appl_Ref (+) and cd.appl_Ref = acbal.appl_Ref (+)  ;


spool off;


exit;

 

 

 

 

 

 

----------------------hccappl.bat------------

@echo off
set /p uid=Oracle ID:
set /p pw=Password:
set /p sn=Service Name:


md C:\hccappl\


echo Generating hccappl file ...

sqlplus %uid%/%pw%@%sn% @genhccappl.sql > C:\hccappl\run.log

if not errorlevel 0 goto err1

echo Batch Completed Successfully.

echo Please find the report in C:\hccappl\
pause
goto end


:err1
echo Error Occurred, please check log files in C:\hccappl\ for details
pause
goto end

:end

 

--------

the final file name is hccappl.dat.  will be generated  contained result data in it.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值