2016-09-14 105 views
0

我想抓取:在oracle中有五位數字沒有值。 我的數據看起來這種格式。如何在oracle中取5個數字的特殊字符?

this :years 2016 only department :12345 
aign:BR-PESP-THELIMITED-:30510 
:thiss and :years 2016 only department :12345 
travel visa :34322 LLL001 

我使用這個查詢

substring(check1,regexp_instr(check1,':'),6)

my current o/p: 
years 
BR-PE 
thiss 
34322 

my expected o/p 
12345 
30510 
12345 
34322 
+1

什麼是你想回來? –

+0

:12345,然後是下一行30510,然後是下一行12345,然後是下一行34322 – Velu

+0

這是一個字符串還是一列?你可以請[編輯]你的問題,以包含_exactly_你想要返回什麼? – Ben

回答

1

如果你想有一個冒號後返回五個數字:

select regexp_substr(check1, ':([0-9]{5})', 1, 1) 
+0

得到這個錯誤 錯誤:函數regexp_substr(字符變化,「未知」,整數,整數)不存在 – Velu

+0

@Velu你確定你在oracle上運行這個嗎? –

+0

謝謝工作好。 – Velu