[每日一题] OCP1z0-047 :2013-08-21 正则表达式---REGEXP_INSTR....................................91

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/10164813



正确答案:D

 

根据题意WHERE条件的意思是“street_address”列中第一个位置不为字符(即为数字),执行以上SQL语句,如下结果:

hr@MYDB> SELECT street_address
  2  FROM locations
  3  WHERE
  4  REGEXP_INSTR(street_address,'[^[:alpha:]]')=1;

STREET_ADDRESS
----------------------------------------
1297 Via Cola di Rie
93091 Calle della Testa
2017 Shinjuku-ku
9450 Kamiya-cho
2014 Jabberwocky Rd
2011 Interiors Blvd
2007 Zagora St
2004 Charade Rd
147 Spadina Ave
6092 Boxwood St
40-5-12 Laogianggen
1298 Vileparle (E)
12-98 Victoria Street
198 Clementi North
8204 Arthur St
9702 Chester Road
20 Rue des Corps-Saints

17 rows selected.



REGEXP_INSTR函数 

语法

说明

REGEXP_INSTR(source_string,pattern
[, start_position
[, occurrence
[, return_option
[, match_parameter]]]])

该函数查找pattern,并返回该模式的第一个位置。您可以随意指定您想要开始搜索的 start_position。 occurrence 参数默认为 1,除非您指定您要查找接下来出现的一个模式。return_option 的默认值为 0,它返回该模式的起始位置;值为 1 则返回符合匹配条件的下一个字符的起始位置。


'^' 匹配输入字符串的开始位置,在方括号表达式中使用,此时它表示不接受该字符集合。

[[:alpha:]] 任何字母

[^[:alpha:]] 非任何字母

如下操作:

gyj@MYDB> select REGEXP_INSTR('guoyJoe','[^[:alpha:]]') from dual;

REGEXP_INSTR('GUOYJOE','[^[:ALPHA:]]')
--------------------------------------
                                     0
gyj@MYDB> select REGEXP_INSTR('1guoyJoe','[^[:alpha:]]') from dual;

REGEXP_INSTR('1GUOYJOE','[^[:ALPHA:]]')
---------------------------------------
                                     


参考官方文档:

 

Examples

The following example examines the string, looking for occurrences of one or more non-blank characters. Oracle begins searching at the first character in the string and returns the starting position (default) of the sixth occurrence of one or more non-blank characters.

gyj@MYDB> SELECT
  2    REGEXP_INSTR('500 Oracle Parkway, Redwood Shores, CA',
  3                 '[^ ]+', 1, 6) "REGEXP_INSTR"
  4    FROM DUAL;


REGEXP_INSTR
------------
          37

The following example examines the string, looking for occurrences of words beginning with s, r, or p, regardless of case, followed by any six alphabetic characters. Oracle begins searching at the third character in the string and returns the position in the string of the character following the second occurrence of a seven-letter word beginning with s, r, or p, regardless of case.

gyj@MYDB> SELECT
  2    REGEXP_INSTR('500 Oracle Parkway, Redwood Shores, CA',
  3                 '[s|r|p][[:alpha:]]{6}', 3, 2, 1, 'i') "REGEXP_INSTR"
  4    FROM DUAL;


REGEXP_INSTR
------------
          28


QQ:252803295

学习交流QQ群:
DSI&Core Search  Ⅰ 群:127149411(技术:已满)
DSI&Core Search  Ⅱ 群:177089463(技术:未满)
DSI&Core Search  Ⅲ 群:284596437(技术:未满)
DSI&Core Search  Ⅳ 群:192136702(技术:未满)
DSI&Core Search  Ⅴ 群:285030382(闲聊:未满)



MAIL:oracledba_cn@hotmail.com

BLOG: http://blog.csdn.net/guoyjoe

WEIBO:http://weibo.com/guoyJoe0218

ITPUB: http://www.itpub.net/space-uid-28460966.html

OCM:   http://education.oracle.com/education/otn/YGuo.HTM



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值