oracle sql 语句 拼接字符

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 station s, 以后为定义一个可复用的city_std查询结果
instr() 查找给点字符的位置
substr() 取子字符串
getxtxx()自定义函数
|| 字符连接

猜你喜欢

转载自heartneo.iteye.com/blog/1865003