过滤指定的字符串,一字符串有重复的数据内容,所以需要去掉重复的内容,subst()截取 起止下标;instr()获取终止下标位置 例如:substr(p.address, 0, instr(p.address, '-', 1, 1)-1) );
case when length(substr(p.address, 0, instr(p.address, '-', 1, 1)-1) )= 13
then substr(substr(p.address, 0, instr(p.address, '-', 1, 1)-1),0,8)||substr(p.address, instr(p.address, '-', 1, 1), length(p.address))
when length(substr(p.address, 0, instr(p.address, '-', 1, 1)-1) )= 11
then substr(substr(p.address, 0, instr(p.address, '-', 1, 1)-1),0,7)||substr(p.address, instr(p.address, '-', 1, 1), length(p.address))
when nvl(length(substr(p.address, 0, instr(p.address, '-', 1, 1)-1) ),0) != 7
and nvl(length(substr(p.address, 0, instr(p.address, '-', 1, 1)-1) ),0) != 8
and length(address) =11
then substr(address,0,7)
when nvl( length(substr(p.address, 0, instr(p.address, '-', 1, 1)-1) ),0) != 8
and nvl(length(substr(p.address, 0, instr(p.address, '-', 1, 1)-1) ),0) != 7
and length(address) =13
then substr(address,0,8)
else address end sub