Skip to Main Content

Japanese

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

正規表現の使用方法について

user154140May 9 2011 — edited May 10 2011
Oracle10g(UNIX環境)で正規表現を使用して下記作業を実施したいのですが、方法が分かりません。
分かる方いましたら教えていただけますでしょうか。

/* 実施したい事 */
select FILE_NAME from dba_datafiles;で、ファイル名のみを抽出する。
※shellで、"basename $0"をsql文で実施したい


/* 備考 */
Oracle® Database SQL Reference10g Release 1 (10.1)には下記記述がありました。
例題のSQL文を利用して、/で区切られた最後のストリングを検索しようとしましたが、どうしてもできません。

次の例では、文字列を調べて、カンマで区切られた最初のサブストリングを検索します。Oracle Databaseは、
後にカンマが付いているカンマでない1つ以上の文字の前にあるカンマを検索します。該当するサブストリング
が、前後のカンマを含めて戻されます。

SELECT
REGEXP_SUBSTR('500 Oracle Parkway, Redwood Shores, CA',
',[^,]+,') "REGEXPR_SUBSTR"
FROM DUAL;

REGEXPR_SUBSTR
-----------------
, Redwood Shores,
This post has been answered by shino on May 10 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2011
Added on May 9 2011
3 comments
325 views