【问题标题】:Case senstive search for alphanumeric values with Regexp_like plsql使用 Regexp_like pl sql 搜索字母数字值的大小写敏感
【发布时间】:2016-04-13 13:36:35
【问题描述】:

我正在尝试在列中查找字母数字值,该值区分大小写。
我尝试了这种模式,但它不起作用。

`REGEXP_LIKE ('1000 - 2000 test', '^[0-9]{4} - [0-9]{4} test', 'c')`

或者是否区分大小写不适用于字母数字值?

【问题讨论】:

  • “不工作”是什么意思?这会返回 false 吗?
  • 一开始没有返回值。但这是我的错,因为声明中有一个空格,我已将其删除并更正。现在它给了我一个价值。很抱歉给您带来不便。

标签: oracle plsql regexp-like


【解决方案1】:

阅读手册http://docs.oracle.com/cd/B12037_01/server.101/b10759/conditions018.htm ;)

 select * from (
           select '1000 - 2000 test' a from dual
 union all select '1000 - 2123 TEST' a from dual
) where
REGEXP_LIKE(a, '^[0-9]{4} - [0-9]{4} test', 'c');

返回

1000 - 2000 test

因为'c'而区分大小写,因此上面给出了1行,而下面使用'i' 不区分大小写给出了2:

 select * from (
           select '1000 - 2000 test' a from dual
 union all select '1000 - 2123 TEST' a from dual
) where
REGEXP_LIKE(a, '^[0-9]{4} - [0-9]{4} test', 'i');

返回

1000 - 2000 test
1000 - 2123 TEST

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-21
    • 2016-05-19
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 2016-01-18
    • 1970-01-01
    • 2019-12-27
    相关资源
    最近更新 更多