SQL语句内容如下:
SELECT to_char(to_date(c.SG2_DEAL_DATE, 'yyyymmdd'), 'yyyy-mm-dd'),
case
when length(decrypt_des(a.user_name, get_secrty_key())) = '2' then
nvl2(decrypt_des(a.user_name, get_secrty_key()),
substr(decrypt_des(a.user_name, get_secrty_key()), 0, 1) || '*',
null)
when length(decrypt_des(a.user_name, get_secrty_key())) = '3' then
nvl2(decrypt_des(a.user_name, get_secrty_key()),
substr(decrypt_des(a.user_name, get_secrty_key()), 0, 2) || '*',
null)
when length(decrypt_des(a.user_name, get_secrty_key())) >= '4' and
instr(decrypt_des(a.user_name, get_secrty_key()), '.', 1) > '0' then
nvl2(decrypt_des(a.user_name, get_secrty_key()),
substr(decrypt_des(a.user_name, get_secrty_key()),
1,
instr(decrypt_des(a.user_name, get_secrty_key()), '.', 1) - 1) || '*',
null)
else
nvl2(decrypt_des(a.user_name, get_secrty_key()),
substr(decrypt_des(a.user_name, get_secrty_key()), 0, 2) || '**',
null)
end,
nvl2(a.CERT_ID,
substr(decrypt_des(a.CERT_ID, get_secrty_key()), 0, 4) ||
'**********' ||
substr(d ecrypt_des(a.CERT_ID, get_secrty_key()), 15, 18),
null),
b.card_sub_type,
c.SG2_CARD_NO,
c.SG2_DEAL_FEE / 100,
to_char(to_date(c.SG2_DEAL_DATE || c.SG2_DEAL_TIME,
'YYYYMMDDHH24MISS'),
'yyyy-mm-dd hh:mm:ss') time,
case
when c.err_code = '000000' then
'00'
else
'01'
end,
c.err_desc,
c.merchant_no,
c.workdate
FROM yy_user_info a, yy_card_info b, qs_wallet_his c
WHERE c.SG2_DEAL_DATE >= to_char(to_date(:1, 'YYYY-MM-DD'), 'YYYYMMDD')
AND c.SG2_DEAL_DATE <= to_char(to_date(:2, 'YYYY-MM-DD'), 'YYYYMMDD')
AND a.user_no(+) = b.user_no
and b.card_no(+) = c.user_no
在yy_user_info 、yy_card_info 、qs_wallet_his 上的user_no、user_no、SG2_DEAL_DATE 都有索引,只是yy_card_info 该表的user_no有null值,其他表索引字段没有null,但是不知为何不走索引,请大师指点