oracle sql语句拼接字符
oracle sql语句拼接字符
Java代码
select city_std || '/' || stationname as name_std, city_std from station s,
(select (select substr(s.name_std,0, instr(s.name_std, '/')-1) from dual) || '.' ||
(select substr(getxtxx(s.maintainunit),0, instr(getxtxx(s.maintainunit), '供')-1)
from dual) as city_std FROM station s where s.stationcode='00000000000001001540')
from dual) as city_std FROM station s where s.stationcode='00000000000001001540')
说明:
from station s, 以后为定义一个可复用的city_std查询结果
instr() 查找给点字符的位置
substr() 取子字符串
getxtxx()自定义函数
|| 字符连接