【发布时间】:2014-08-18 05:45:11
【问题描述】:
我有一个类似的 sql 查询
从emp中选择count(distinct empno),count(distinct(deptno empname empid))
我想获取第一次出现的计数及其内容,例如:
count(distinct empno)
我尝试了下面的sql语句,但它不起作用,
SQL >select regexp_substr('select count(distinct empno), count(distinct(deptno)) from emp', 'count *( distinct .)') 从双;
REGEXP_SUBSTR('SELECTCOUNT(DISTINCTEMPNO),COUN ---------------------------------- 计数(不同的empno ), count(distinct(deptno ))
我希望输出返回如下:
REGEXP_SUBSTR('SELECTCOUNT(DISTINCTEMPNO)
count(distinct empno),
正则表达式不应该匹配第二个)右括号,它应该匹配第一个右括号。
【问题讨论】:
-
Issue with Oracle regex 的可能重复项