可以試試這個語法唷~
select substr(atable,instr(atable,'0',-1)+1,10)
from (
select substr(atable,121,7) atable from table A
);
ˊ
※ 引述《erho (ptt訪客)》之銘言:
: 資料庫名稱:oracle
: 資料庫版本:9i
: 內容/問題描述:
: table A有一個column為 atable varchar(190)
: 輸入 select substr(atable,121,7) from table A;
: 的結果為
: 0001236
: 0000782
: 0000107
: 0000227
: 0001489
: 我使用想讓輸出的結果為
: 1236
: 782
: 107
: 227
: 1489
: 使用TO_NUMBER函式都回應ORA-01722: invalid number
: select to_number('substr(atable,121,7)') from table A
: 請教各位大大這個語法的問題在那裡,望賜教
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 124.199.97.84
※ 文章網址: https://www.ptt.cc/bbs/Database/M.1423560426.A.6C5.html