2016-09-14 109 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