RE: regular expression to get ORA- errors out of text

  • From: "Herring Dave - dherri" <Dave.Herring@xxxxxxxxxx>
  • To: <tanel@xxxxxxxxxx>, <goryunov.oracle.l@xxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 18 Feb 2009 07:33:22 -0600

Depending on the volume, you may want to play with different options to see 
which works best for you.  We've got instances where millions of rows are being 
checked and I found that using 'i' for case insensitivity was actually slower 
than using UPPER().

David C. Herring  | DBA, Acxiom Automotive

630-944-4762 office | 630-430-5988 cell | 630-944-4989 fax
1501 Opus Pl | Downers Grove, IL, 60515 | U.S.A. | www.acxiom.com


________________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Tanel Poder
Sent: Saturday, February 14, 2009 10:26 PM
To: goryunov.oracle.l@xxxxxxxxx; oracle-l@xxxxxxxxxxxxx
Subject: RE: regular expression to get ORA- errors out of text

Hi Andrey,
 
SQL> define str="    ORA-00001 ora-0002     ora   ora-003    aasdlkja alksdj 
alksdj laskdj  ORA-04 aaaa a  a a aora-5   "
SQL>
SQL> select regexp_substr('&str', 'ora-[[:digit:]]{1,5}', 1, level, 'i')
  2  from dual
  3  connect by regexp_substr('&str', 'ora-[[:digit:]]{1,5}', 1, level, 'i') is 
not null
  4  /
 
REGEXP_SUBSTR('ORA-00001ORA-0002ORAORA-003AASDLKJAALKSDJALKSDJLASKDJORA-04AAAAAAAAORA-5','ORA-[[:DIGIT:
-------------------------------------------------------------------------------------------------------
ORA-00001
ora-0002
ora-003
ORA-04
ora-5
 
5 rows selected.
 
SQL>
 
--
Tanel Poder
http://blog.tanelpoder.com
 
 

________________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Andrey Goryunov
Sent: 14 February 2009 20:34
To: oracle-l@xxxxxxxxxxxxx
Subject: regular expression to get ORA- errors out of text
Hi All,

what regular expression would you suggest to get all ORA- errors (with from 1 
to 5 numbers)
out of some text like this:

'    ORA-00001 ora-0002     ora   ora-003    aasdlkja alksdj alksdj laskdj  
ORA-04 aaaa a  a a aora-5   '


I am trying to figure out how to use
regexp_replace to replace all characters around ora-... errors to get output:

'ORA-00001 ora-0002 ora-003 ORA-04 ora-5'

but can't find appropriate expression so far:

with s1 as (select '    ORA-00001 ora-0002     ora   ora-003    aasdlkja alksdj 
alksdj laskdj  ORA-04 aaaa a  a a aora-5   ' s from dual)
select regexp_replace(s, '...', '...', 1, 0, 'i') from s1
/


-- 
Regards,
Andrey Goryunov
***************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank You.
****************************************************************************

--
//www.freelists.org/webpage/oracle-l


Other related posts: