oracle按特定字符截取字符串 oracle如何截取指定字符串?
oracle如何截取指定字符串?
oracle中,截取某个字符串前的字符需要用instr函数和substr函数共同完成。工具:oracle 10g步骤:1、以截取字符串“210-1106000001”中“-”前的部分为例。2、执行语句为:select substr("210-1106000001",1,instr("210-1106000001","-")-1) from dual3、结果为:instr函数语法:instr( string1, string2, start_position,nth_appearance )参数含义:substr函数语法:substr(strings|express,m,[n])参数含义:strings|express :被截取的字符串或字符串表达式。m 从第m个字符开始截取。n 截取后字符串长度为n。
oracle怎么截取指定字符后面的字符串,或者删除指定字符前面的字符串也行?
取最后一个后面的字符select substr("D:AssetsManagementresourceehcachetest.txt",1 (select instr ("D:AssetsManagementresourceehcachetest.txt","",1,(select length("D:AssetsManagementresourceehcachetest.txt") - length(replace("D:AssetsManagementresourceehcachetest.txt","","")) from dual)) from dual),length("D:AssetsManagementresourceehcachetest.txt")-(select instr ("D:AssetsManagementresourceehcachetest.txt","",1,(select length("D:AssetsManagementresourceehcachetest.txt") - length(replace("D:AssetsManagementresourceehcachetest.txt","","")) from dual)) from dual)) from dual如果前面D:AssetsManagementresourceehcache是固定的就直接replace了select replace("D:AssetsManagementresourceehcachetest.txt","D:AssetsManagementresourceehcache","") from dual
oracle按特定字符截取字符串 sql截取指定字符串 oracle截取字符串最后两位
版权声明:本文内容由互联网用户自发贡献,本站不承担相关法律责任.如有侵权/违法内容,本站将立刻删除。