【发布时间】:2014-11-25 19:46:48
【问题描述】:
我试图在 Oracle SQL Developer 中使用 regexp_substr 和 instr 从我的数据库中获取一个值,然后从右到左到第一个“/”,然后使用右边的值。
table name: access_log
col name: download
value: Download file:/webdocs/data/groupXXX/case/03_28_54_9_0000011856.pdf
我试图只得到价值的 03_28_54_9_0000011856.pdf 部分。我有以下 SQL:
select regexp_substr(download, '(.*)/', instr(download,'/',1,4)+1,1,'i',1)
from access_log;
但我在 SQL Developer 中收到以下错误:
ORA-00939: too many arguments for function
00939. 00000 - "too many arguments for function"
*Cause:
*Action:
谁能告诉我为什么我会收到这个错误以及我如何才能做到这一点
【问题讨论】:
-
download列的类型是什么? -
在您的实际用例中有什么东西可以强制
REGEXP_INTSTR和INSTR结合使用吗? -
更简单的方法:
regexp_replace(download, '.*/', '') -
Wumpus Q. Wumbley 请发表你的答案,我给你信用
-
@WumpusQ.Wumbley 将其发布为答案。
标签: regex oracle substring oracle-sqldeveloper