力扣-102-二叉樹的層次遍歷
阿新 • • 發佈:2022-03-30
select a.id as id,
SUBSTR(a.oc_date,1,4)||'-'||SUBSTR(a.oc_date,5,2)||'-'||SUBSTR(a.oc_date,7,2) as oc_date,
a.client_id,
nvl(ac.client_name, a.client_id) as client_name,
a.stock_code,
nvl(c.stock_name, a.stock_code) as stock_name,
nvl(a.occ_value1, 0) as priceratio,
nvl(a.occ_value3, 0) as ratio1,
nvl(a.occ_value1, 0) as count,
cast(nvl(a.occ_value2, 0) / 10000 as number(22,2)) as reverse_amount,
cast(nvl(a.occ_value1, 0) / 10000 as number(22,2)) as entrust_balance,
cast(nvl(a.occ_value4, 0) / 10000 as number(22,2)) as business_amount,
cast(nvl(a.occ_value4, 0) / 10000 as number(22,2)) as entrust_amount,
nvl(a.occ_value1, 0) as occ_count,
nvl(a.occ_value2, 0) as withdraw_ratio,
nvl(a.occ_value3, 0) as withdraw_count,
decode(a.entrust_bs, '1', '買入', '2', '賣出', ' ') as entrust_bs, -- 委託
decode(a.entrust_bs, '2', '買入', '1', '賣出', ' ') as rev_entrust_bs, -- 反向委託
(case when a.entrust_bs = '1' then '漲' else '跌' end) as updown,
nvl(a.occ_value1, 0) as ratio,
nvl(a.occ_value4, 0) as reverse_count,
a.risk_id,a.branch_no,
i.risk_name as risk_name,ub.branch_name,ar.description,
(SELECT cast(init_date as char(8)) as init_date FROM hscon.sys_ics_arg) as DTDATE
from hsics.spb_risk_push_oa rpo
left join hsics.r_ics_monitor_result a on rpo.risk_id=a.risk_id
left join hscon.rmm_risk_item i on a.risk_id = i.risk_id
left join hscon.uam_branch ub on ub.branch_no=a.branch_no
left join hsods.act_client ac on ac.CLIENT_ID=a.CLIENT_ID
left join hscon.atmp_riskinfo_template ar on ar.risk_id=a.risk_id
left join hsods.iqs_stockcode c on a.exchange_type = c.exchange_type and a.stock_code = c.stock_code
where a.risk_level in (${riskLevel}) and a.risk_deal_flag ='0' and rpo.status='1' and rpo.company_no=(SELECT company_no FROM hscon.uam_company)