数据脱敏sql_substr

1 (手机号显示前两位后三位中间用*表示)
set mobile_no =(case when mobile_no is not null then substr(mobile_no,1,2)||'******'||substr(mobile_no,9) else null end)

2(身份证隐藏年月日)
set CERTIFICATE_CODE=(case when CERTIFICATE_CODE is not null then substr(CERTIFICATE_CODE,1,6)||'********'||substr(CERTIFICATE_CODE,15) else null end )

3银行卡显示后四位
set REPAY_ACCOUNT_NO=(case when REPAY_ACCOUNT_NO is not null then '************'||substr(REPAY_ACCOUNT_NO,13) else null end)

substr('abcdf',1,3)=adb 从1开始计数,截取3为

substr('abcdef',2,3)=bcd 从第二位开始包含第二位,截取三位。

substr('abcdef',5)=ef 从第五位开始包含第五名,截取到最后。

posted @ 2017-03-30 11:04  暖暖-木木  阅读(7525)  评论(0编辑  收藏  举报