Sql SACTION' 当tlt.fe_type='TPTP101'和其他_ref_type为null且终端_type不在('ATM','POS')时,则终端_type 当tlt.fe_type='TPTP101'和其他_ref_type为空时,则为'POS'

Sql SACTION' 当tlt.fe_type='TPTP101'和其他_ref_type为null且终端_type不在('ATM','POS')时,则终端_type 当tlt.fe_type='TPTP101'和其他_ref_type为空时,则为'POS' ,sql,Sql,SACTION' 当tlt.fe_type='TPTP101'和其他_ref_type为null且终端_type不在('ATM','POS')时,则终端_type 当tlt.fe_type='TPTP101'和其他_ref_type为空时,则为'POS' 当tlt.fe_type='TPTP104'和其他_ref_type='FEEC13'时,则为'ATM现金取款费' 当tlt.fe_type='TPTP700'和其他_ref_type='FEEC13'时,则为'ATM现金取款费' 当tlt.f

SACTION' 当tlt.fe_type='TPTP101'和其他_ref_type为null且终端_type不在('ATM','POS')时,则终端_type 当tlt.fe_type='TPTP101'和其他_ref_type为空时,则为'POS' 当tlt.fe_type='TPTP104'和其他_ref_type='FEEC13'时,则为'ATM现金取款费' 当tlt.fe_type='TPTP700'和其他_ref_type='FEEC13'时,则为'ATM现金取款费' 当tlt.fe_type='TPTP109'和其他_ref_type为空时,则为'return' 当tlt.fe_type='TPTP700'和其他_ref_type='FEEC125'时,则为'ATM现金取款费' 当bo_type='CMTP920'和其他_ref_type为空时,则为“费用调整” 当tlt.fe_type为null且其他_ref_type='FEEC140'时,则为'FEE CARD ISSUE' 当tlt.fe_type为null,而other_ref_type='FEEC141'时,则为'FEE REISSUE slated CARD' 当tlt.fe_类型为空且其他_ref_类型为'FEEC150'时,则为'FEE CARD RE-ISSUE' 当tlt.fe_类型为空且其他_ref_类型为'FEEC153'时,则为'CARD REISSUE FOR discreated CARD(PLASTIC)' 当tlt.fe_type为null且其他_ref_type='FEEC170'时,则为'FEE CARD MAINTENANCE CYCLE' 当tlt.fe_类型为空且其他_ref_类型为'FEED248'时,则为'FEE OVERLIMIT' 当tlt.fe_类型为空且其他_ref_类型为'CREDPN'时,则为'FEE LATE PAYMENT' 当tlt.fe_类型为空且其他_ref_类型为'CREDPR'时,则为'CREDIT INTEREST' 当tlt.fe_类型为空且其他_ref_类型为'CREDPROV'时,则为'OVERLIMIT信用利息' 当tlt.fe_type='TPTP678'和其他_ref_type为空时,则为'EPOS采购完成' 当tlt.fe_type='TPTP680'和其他_ref_type为空时,则为'EPOS PURCHASE' 当tlt.fe_type='TPTPA01'和其他_ref_type为空时,则为'POS PURCHASE' 当tlt.fe_type为null且其他_ref_type='FEEC152'时,则为'CARD AUTO REISSUE' 当tlt.Other_ref_type='FEEC49'然后是'MARKUP' 当tlt.Other_ref_type不为null且tlt.fe_type不为null时,则“交易费” 否则无效 端转换类型, alt.CARDACCIDC作为“商户”, alt.ADDRESS\u NAME作为“ADDRS NAME”, 备选地址为“ADDRS STREET”, alt.ADDRESS_COUNTRY为“ADDRS COUNTRY”, alt.terminal_类型, alt.fe_utrno 从ISS_卡_选项卡ict, ISS卡合同选项卡续, 卡片类型标签ctt, 传输日志选项卡tlt, EP_ISOCUR_标签eit, 代码选项卡ct, 验证日志选项卡alt 其中ict.INST_ID=4027 和ict.CARD_CONTRACT=cont.CONTRACT_ID 和ctt.card_type=ict.card_INT_type --和ict.ATM账户in(tlt.ACCT账户NUM1,'GL51195') 和tlt.ACCT_NUM1 IN(ict.ATM_ACCT) 和tlt.CURRENCY1=eit.NCUR 和nvl(tlt.proc_名称,'x')‘RVO’ --和ct.KEY='TPTP' 和ct.VALUE=Substr(tlt.FE_类型,5,7) tlt.TR_GROUP_ID=alt.match_num --以及trunc(sysdate-:days,'DD')和trunc(sysdate-(:days-1,'DD')-.00001之间的alt.udatetime 联盟 选择 UDATETIME, 续合同说明, substr(ict.card_num,1,6)| | |‘*****’| | substr(ict.card_num,13,4)作为“卡号”, --ict.ISS_日期为“最初发布日期”, ict.ATM账户作为“账号”, --ict.PRIMARY, --ctt.SPECIAL_类型为“卡片类型详情1”, ict.CRDH_名称为“浮雕名称”, 案例 当tlt.amnt1=0.0时,则为“0.00” 其他至字符(tlt.amnt1/100,'9999999.99') 以“金额”结尾, --tlt.TR_组Id, eit.ACUR作为“货币”, 将字符((alt.UDATETIME),'dd-mm-yyyyy HH24:MI:SS')作为“TRNX\u日期”, 将字符((alt.STTL_DATE),'dd-mm-yyyyy HH24:MI:SS')作为“结算日期”, 将字符((alt.UDATETIME),'HH24:MI:SS')改为“TRNX\u TIME”, --当fe_类型='TPTP104'和其他_ref_类型='FEEC13'时,则为'ATM费'TP760 案例——信用TRXN 当原因不为空时(从t_代码选项卡中选择substr(值描述,1,16),其中concat(键,值)=原因) 当bo_类型='CMTP700'和tran_place='PAYMENT FROM AGENT FILE ID'时,则为'持卡人付款' 当bo_类型='CMTP700'和tran_place='分行付款'时,则为'持卡人付款' 当bo_类型='CMTP700'时,则转换位置 当bo_类型='CMTP700'且交易地点为空时,则为“持卡人付款” 当bo_类型为“CMTP703”时,则为“持卡人付款” 当bo_类型为“CMTP709”时,则为“持卡人调整不收费” 当tlt.fe_类型=
select * from (

select
UDATETIME,
cont.CONTRACT_DESC,
substr(ict.card_num,1,6) || '******' || substr (ict.card_num,13,4) as "CARD NUMBER",
--ict.ISS_DATE AS "DATE ORIGINALLY ISSUED",
ict.ATM_ACCT                                                       as "Account_Number",
--ict.PRIMARY,                                                     
--ctt.SPECIAL_TYPE AS "CARD TYPE DETAIL 1",                        
ict.CRDH_NAME                                                      as "EMBOSSED NAME",
case                                                               
when tlt.amnt1 = 0.0 then '        0.00'                             
else  to_char(tlt.amnt1/100,'99999999.99')                         
end                                                                as "AMT",
--tlt.TR_GROUP_Id,                                                 
eit.ACUR                                                           as "CURRENCY",
to_char((alt.UDATETIME ),'dd-mm-yyyy HH24:MI:SS')                  as "TRNX_DATE",
to_char((alt.STTL_DATE ),'dd-mm-yyyy HH24:MI:SS')                  as "SETTL_DATE",
to_char((alt.UDATETIME ),'HH24:MI:SS')                              as "TRNX_TIME",
-- when fe_type = 'TPTP104' and other_ref_type = 'FEEC13'                      then 'ATM FEE'  TPTP760
       case -- CREDIT TRXN
            when reason is not null then (select  substr(value_desc,1,16) from t_codes_tab where concat(key,value) = reason)
            when bo_type       = 'CMTP700' and tran_place = 'PAYMENT FROM AGENT  FILE ID '    then 'CARDHOLDER PAYMENT'
            when bo_type       = 'CMTP700' and tran_place = 'PAYMENT AT BRANCH'               then 'CARDHOLDER PAYMENT'
            when bo_type       = 'CMTP700'                                                    then tran_place
            when bo_type       = 'CMTP700' and tran_place is null                             then 'CARDHOLDER PAYMENT'
            when bo_type       = 'CMTP703'                                                    then 'CARDHOLDER PAYMENT'
            when bo_type       = 'CMTP709'                                                    then 'CARDHOLDER ADJUSTMENT WITHOUT FEE'
            when tlt.fe_type   = 'TPTP206'                                                    then 'REFUND / CREDIT'
            when terminal_type = 'ATM'     and tlt.fe_type = 'TPTP774'                        then 'FUND D FONE'
            when tlt.fe_type   = 'TPTP227'                                                    then 'CASH DISBURSEMENT REVERSAL'
            when tlt.fe_type   = 'TPTP785'                                                    then 'CREDIT PART OF P2P TRXN'
            when tlt.fe_type   = 'TPTP707'                                                    then 'PAYMENT FROM ENVELOP'
            when tlt.fe_type   = 'TPTP225'                                                    then 'VISA SALES DRAFT REVERSAL'
            when tlt.fe_type   = 'TPTP760'                                                    then 'CREDIT ACCOUNT PRESENTMENT'

         --   DEBIT TRXN
            when bo_type            = 'CMTP702'        and tran_place     = 'WITHDRAWAL FROM AGENT  FILE ID '             then 'WITHDRAWAL FROM ACCOUNT'
            when bo_type            = 'CMTP702'        and tran_place     is null                                         then 'WITHDRAWAL FROM ACCOUNT'
            when bo_type            = 'CMTP704'        and other_ref_type like 'FEED%'                                    then 'ACCOUNT FEE'
            when tlt.fe_type        = 'TPTP659'        and other_ref_type ='FEEC1'                                        then 'LOAD DECLINE FEE'
            when bo_type            = 'CMTP742'                                                                           then 'MIGRATION'
            when bo_type            = 'CMTP704'        and other_ref_type is null                                         then 'WITHDRAWAL FROM ACCOUNT ADJ'
            when bo_type            = 'CMTP900'        and other_ref_type is null                                         then 'POS PURCHASE'
            when bo_type            = 'CMTP741'        and other_ref_type is null                                         then 'SMS FEE'
            when tlt.fe_type        = 'TPTP659'        and other_ref_type is null                                         then 'SMS FEE'
            when tlt.fe_type        = 'TPTP703'        and other_ref_type is null                                         then 'ACCOUNT ADJUSTMENT'
            when tlt.fe_type        = 'TPTP205'        and other_ref_type is null                                         then 'POS RETAIL'
            when tlt.fe_type        = 'TPTP205'        and other_ref_type is null                                         then 'UNIQUE TRANSACTION'
            when tlt.fe_type        = 'TPTP207'        and other_ref_type is null                                         then 'ATM CASH WITHDRAWAL'
            when tlt.fe_type        = 'TPTP700'        and other_ref_type is null                                         then 'ATM CASH WITHDRAWAL'
            when tlt.fe_type        = 'TPTP207'        and other_ref_type = 'FEEC10'                                      then 'FEE COLLECTION - ATM FEE'
            when tlt.fe_type        = 'TPTP700'        and other_ref_type = 'FEEC66'                                      then 'FEE COLLECTION - ATM FEE'
            when tlt.fe_type        = 'TPTP104'        and other_ref_type is null                                         then 'ATM CASH WITHDRAWAL'
            when tlt.fe_type        = 'TPTP105'        and other_ref_type is null                                         then 'CASINO TRANSACTION'
            when tlt.fe_type        = 'TPTP101'        and other_ref_type is null and terminal_type not in ('ATM','POS')  then terminal_type
            when tlt.fe_type        = 'TPTP101'        and other_ref_type is null                                         then 'POS'
            when tlt.fe_type        = 'TPTP104'        and other_ref_type = 'FEEC13'                                      then 'ATM CASH WITHDRAWAL FEE'
            when tlt.fe_type        = 'TPTP700'        and other_ref_type = 'FEEC13'                                      then 'ATM CASH WITHDRAWAL FEE'
            when tlt.fe_type        = 'TPTP109'        and other_ref_type is null                                         then 'REFUND'
            when tlt.fe_type        = 'TPTP700'        and other_ref_type = 'FEEC125'                                     then 'ATM CASH WITHDRAWAL FEE'
            when bo_type            = 'CMTP920'        and other_ref_type is null                                         then 'FEE ADJUSTMENT'
            when tlt.fe_type        is null            and other_ref_type = 'FEEC140'                                     then 'FEE CARD ISSUE'
            when tlt.fe_type        is null            and other_ref_type = 'FEEC141'                                     then 'FEE REISSUE STOLEN CARD'
            when tlt.fe_type        is null            and other_ref_type = 'FEEC150'                                     then 'FEE CARD RE-ISSUE'
            when tlt.fe_type        is null            and other_ref_type = 'FEEC153'                                     then 'CARD REISSUE FOR DAMAGED CARD (PLASTIC)'
            when tlt.fe_type        is null            and other_ref_type = 'FEEC170'                                     then 'FEE CARD MAINTENANCE CYCLE'
            when tlt.fe_type        is null            and other_ref_type = 'FEED248'                                     then 'FEE OVERLIMIT'
            when tlt.fe_type        is null            and other_ref_type = 'CREDPN'                                      then 'FEE LATE PAYMENT'
            when tlt.fe_type        is null            and other_ref_type = 'CREDPR'                                      then 'CREDIT INTEREST'
            when tlt.fe_type        is null            and other_ref_type = 'CREDPROV'                                    then 'CREDIT INTEREST ON OVERLIMIT'
            when tlt.fe_type        = 'TPTP678'        and other_ref_type is null                                         then 'EPOS PURCHASE COMPLETION'
            when tlt.fe_type        = 'TPTP680'        and other_ref_type is null                                         then 'EPOS PURCHASE'
            when tlt.fe_type        = 'TPTPA01'        and other_ref_type is null                                         then 'POS PURCHASE'
            when tlt.fe_type        is null            and other_ref_type = 'FEEC152'                                     then 'CARD AUTO REISSUE'
            when tlt.Other_ref_type ='FEEC49'                                                                             then 'MARKUP'
            when tlt.Other_ref_type is not null        and tlt.fe_type    is not null                                     then 'TRANSACTION FEE'
            else null
       end trans_type,
alt.CARDACCIDC      as "MERCHANT",
alt.ADDRESS_NAME    as "ADDRS NAME",
alt.ADDRESS_STREET  as "ADDRS STREET",
alt.ADDRESS_COUNTRY as "ADDRS COUNTRY",
alt.terminal_type,
alt.fe_utrnno
from ISS_CARD_TAB ict,
ISS_CARD_CONTRACT_TAB cont,
CARD_TYPE_TAB ctt,
TRAN_LOG_TAB tlt,
EP_ISOCUR_TAB eit,
CODES_TAB ct,
AUTH_LOG_TAB alt
where ict.INST_ID = 4027
and ict.CARD_CONTRACT = cont.CONTRACT_ID
and ctt.card_type = ict.CARD_INT_TYPE
--and  ict.ATM_ACCT in (tlt.ACCT_NUM1,'GL51195')
and tlt.ACCT_NUM1 IN (ict.ATM_ACCT)
and tlt.CURRENCY1 = eit.NCUR
and nvl(tlt.proc_name,'x') <> 'RVO'
--and ct.KEY = 'TPTP'
and ct.VALUE = Substr (tlt.FE_TYPE,5,7)
AND tlt.TR_GROUP_ID = alt.match_num
--AND alt.udatetime between trunc(sysdate-:days,'DD') and trunc(sysdate-(:days-1),'DD') - .00001


union



select
UDATETIME,
cont.CONTRACT_DESC,
substr(ict.card_num,1,6) || '******' || substr (ict.card_num,13,4) as "CARD NUMBER",
--ict.ISS_DATE AS "DATE ORIGINALLY ISSUED",
ict.ATM_ACCT                                                       as "Account_Number",
--ict.PRIMARY,
--ctt.SPECIAL_TYPE AS "CARD TYPE DETAIL 1",
ict.CRDH_NAME                                                      as "EMBOSSED NAME",
case
when tlt.amnt1 = 0.0 then '        0.00'
else  to_char(tlt.amnt1/100,'99999999.99')
end                                                                as "AMT",
--tlt.TR_GROUP_Id,
eit.ACUR                                                           as "CURRENCY",
to_char((alt.UDATETIME ),'dd-mm-yyyy HH24:MI:SS')                  as "TRNX_DATE",
to_char((alt.STTL_DATE ),'dd-mm-yyyy HH24:MI:SS')                  as "SETTL_DATE",
to_char((alt.UDATETIME),'HH24:MI:SS')                              as "TRNX_TIME",
-- when fe_type = 'TPTP104' and other_ref_type = 'FEEC13'                      then 'ATM FEE'  TPTP760
       case -- CREDIT TRXN
            when reason is not null then (select  substr(value_desc,1,16) from t_codes_tab where concat(key,value) = reason)
            when bo_type       = 'CMTP700' and tran_place = 'PAYMENT FROM AGENT  FILE ID '    then 'CARDHOLDER PAYMENT'
            when bo_type       = 'CMTP700' and tran_place = 'PAYMENT AT BRANCH'               then 'CARDHOLDER PAYMENT'
            when bo_type       = 'CMTP700'                                                    then tran_place
            when bo_type       = 'CMTP700' and tran_place is null                             then 'CARDHOLDER PAYMENT'
            when bo_type       = 'CMTP703'                                                    then 'CARDHOLDER PAYMENT'
            when bo_type       = 'CMTP709'                                                    then 'CARDHOLDER ADJUSTMENT WITHOUT FEE'
            when tlt.fe_type   = 'TPTP206'                                                    then 'REFUND / CREDIT'
            when terminal_type = 'ATM'     and tlt.fe_type = 'TPTP774'                        then 'FUND D FONE'
            when tlt.fe_type   = 'TPTP227'                                                    then 'CASH DISBURSEMENT REVERSAL'
            when tlt.fe_type   = 'TPTP785'                                                    then 'CREDIT PART OF P2P TRXN'
            when tlt.fe_type   = 'TPTP707'                                                    then 'PAYMENT FROM ENVELOP'
            when tlt.fe_type   = 'TPTP225'                                                    then 'VISA SALES DRAFT REVERSAL'
            when tlt.fe_type   = 'TPTP760'                                                    then 'CREDIT ACCOUNT PRESENTMENT'

         --   DEBIT TRXN
            when bo_type            = 'CMTP702' and tran_place     = 'WITHDRAWAL FROM AGENT  FILE ID '                     then 'WITHDRAWAL FROM ACCOUNT'
            when bo_type            = 'CMTP702' and tran_place     is null                                                 then 'WITHDRAWAL FROM ACCOUNT'
            when bo_type            = 'CMTP704' and other_ref_type like 'FEED%'                                            then 'ACCOUNT FEE'
            when bo_type            = 'CMTP742'                                                                            then 'MIGRATION'
            when bo_type            = 'CMTP704' and other_ref_type is null                                                 then 'WITHDRAWAL FROM ACCOUNT ADJ'
            when bo_type            = 'CMTP900' and other_ref_type is null                                                 then 'POS PURCHASE'
            when bo_type            = 'CMTP741' and other_ref_type is null                                                 then 'SMS FEE'
            when tlt.fe_type        = 'TPTP659' and other_ref_type is null                                                 then 'SMS FEE'
            when tlt.fe_type        = 'TPTP703' and other_ref_type is null                                                 then 'ACCOUNT ADJUSTMENT'
            when tlt.fe_type        = 'TPTP205' and other_ref_type is null                                                 then 'POS RETAIL'
            when tlt.fe_type        = 'TPTP205' and other_ref_type is null                                                 then 'UNIQUE TRANSACTION'
            when tlt.fe_type        = 'TPTP207' and other_ref_type is null                                                 then 'ATM CASH WITHDRAWAL'
            when tlt.fe_type        = 'TPTP700' and other_ref_type is null                                                 then 'ATM CASH WITHDRAWAL'
            when tlt.fe_type        = 'TPTP659' and other_ref_type ='FEEC1'                                                then 'LOAD DECLINE FEE'
            when tlt.fe_type        = 'TPTP207' and other_ref_type = 'FEEC10'                                              then 'FEE COLLECTION - ATM FEE'
            when tlt.fe_type        = 'TPTP700' and other_ref_type = 'FEEC66'                                              then 'FEE COLLECTION - ATM FEE'
            when tlt.fe_type        = 'TPTP104' and other_ref_type is null                                                 then 'ATM CASH WITHDRAWAL'
            when tlt.fe_type        = 'TPTP105' and other_ref_type is null                                                 then 'CASINO TRANSACTION'
            when tlt.fe_type        = 'TPTP101' and other_ref_type is null and terminal_type not in ('ATM','POS')          then terminal_type
            when tlt.fe_type        = 'TPTP101' and other_ref_type is null                                                 then 'POS'
            when tlt.fe_type        = 'TPTP104' and other_ref_type = 'FEEC13'                                              then 'ATM CASH WITHDRAWAL FEE'
            when tlt.fe_type        = 'TPTP700' and other_ref_type = 'FEEC13'                                              then 'ATM CASH WITHDRAWAL FEE'
            when tlt.fe_type        = 'TPTP109' and other_ref_type is null                                                 then 'REFUND'
            when tlt.fe_type        = 'TPTP700' and other_ref_type = 'FEEC125'                                             then 'ATM CASH WITHDRAWAL FEE'
            when bo_type            = 'CMTP920' and other_ref_type is null                                                 then 'FEE ADJUSTMENT'
            when tlt.fe_type        is null     and other_ref_type = 'FEEC140'                                             then 'FEE CARD ISSUE'
            when tlt.fe_type        is null     and other_ref_type = 'FEEC141'                                             then 'FEE REISSUE STOLEN CARD'
            when tlt.fe_type        is null     and other_ref_type = 'FEEC150'                                             then 'FEE CARD RE-ISSUE'
            when tlt.fe_type        is null     and other_ref_type = 'FEEC153'                                             then 'CARD REISSUE FOR DAMAGED CARD (PLASTIC)'
            when tlt.fe_type        is null     and other_ref_type = 'FEEC170'                                             then 'FEE CARD MAINTENANCE CYCLE'
            when tlt.fe_type        is null     and other_ref_type = 'FEED248'                                             then 'FEE OVERLIMIT'
            when tlt.fe_type        is null     and other_ref_type = 'CREDPN'                                              then 'FEE LATE PAYMENT'
            when tlt.fe_type        is null     and other_ref_type = 'CREDPR'                                              then 'CREDIT INTEREST'
            when tlt.fe_type        is null     and other_ref_type = 'CREDPROV'                                            then 'CREDIT INTEREST ON OVERLIMIT'
            when tlt.fe_type        = 'TPTP678' and other_ref_type is null                                                 then 'EPOS PURCHASE COMPLETION'
            when tlt.fe_type        = 'TPTP680' and other_ref_type is null                                                 then 'EPOS PURCHASE'
            when tlt.fe_type        = 'TPTPA01' and other_ref_type is null                                                 then 'POS PURCHASE'
            when tlt.fe_type        is null     and other_ref_type = 'FEEC152'                                             then 'CARD AUTO REISSUE'
            when tlt.Other_ref_type ='FEEC49'                                                                              then 'MARKUP'
            when tlt.Other_ref_type is not null and tlt.fe_type is not null                                                then 'TRANSACTION FEE'
            else null
       end trans_type,
alt.CARDACCIDC       as "MERCHANT",
alt.ADDRESS_NAME     as "ADDRS NAME",
alt.ADDRESS_STREET   as "ADDRS STREET",
alt.ADDRESS_COUNTRY  as "ADDRS COUNTRY",
alt.terminal_type,
alt.fe_utrnno
from ISS_CARD_TAB ict,
ISS_CARD_CONTRACT_TAB cont,
CARD_TYPE_TAB ctt,
TRAN_LOG_TAB tlt,
EP_ISOCUR_TAB eit,
CODES_TAB ct,
AUTH_LOG_TAB alt
where ict.INST_ID = 4027
and ict.CARD_CONTRACT = cont.CONTRACT_ID
and ctt.card_type = ict.CARD_INT_TYPE
--and  ict.ATM_ACCT in (tlt.ACCT_NUM1,'GL51195')
and tlt.ACCT_NUM2 IN (ict.ATM_ACCT)
and tlt.CURRENCY1 = eit.NCUR
--and ct.KEY = 'TPTP'
and ct.VALUE = Substr (tlt.FE_TYPE,5,7)
AND tlt.TR_GROUP_ID = alt.match_num
--AND alt.udatetime between trunc(sysdate-:days,'DD') and trunc(sysdate-(:days-1),'DD') - .00001
) order by UDATETIME asc;