标签: sql oracle plsql substr
我有一个字符串x='SP0045.32489455187.206205008796197',我需要字符串为'SP0045.32489455187'。什么可能是我的SQL查询。
x='SP0045.32489455187.206205008796197'
'SP0045.32489455187'
答案 0 :(得分:2)
假设您的规则是discard everything after and including the second ".",那么:
discard everything after and including the second "."
substr(x, 1, instr(x,'.',1,2)-1)
有关详细信息,请参阅instr和substr的文档。