dbTalk Databases Forums  

String Comparisons in Oracle 9i

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss String Comparisons in Oracle 9i in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fester Bestertester
 
Posts: n/a

Default String Comparisons in Oracle 9i - 10-22-2007 , 01:36 PM






Greetings,

We are using Oracle 9i. Are regexp functions available in Oracle 9i, or
was that introduced with 10?

Given the following two strings:
str_a='5838 MISSION CENTER RD #C'
str_b='5838 MISSION CENTER RD C'

or
str_a='7576 PARKWAY DR APT #2A'
str_b='7576 PARKWAY DR APT 2A'

is it possible to write an expression in Oracle 9i that will return true
if the only difference between the two strings is the presence of the
'#' symbol?

Reply With Quote
  #2  
Old   
Brian Peasland
 
Posts: n/a

Default Re: String Comparisons in Oracle 9i - 10-22-2007 , 01:54 PM






Fester Bestertester wrote:
Quote:
Greetings,

We are using Oracle 9i. Are regexp functions available in Oracle 9i, or
was that introduced with 10?

Given the following two strings:
str_a='5838 MISSION CENTER RD #C'
str_b='5838 MISSION CENTER RD C'

or
str_a='7576 PARKWAY DR APT #2A'
str_b='7576 PARKWAY DR APT 2A'

is it possible to write an expression in Oracle 9i that will return true
if the only difference between the two strings is the presence of the
'#' symbol?
Regular expressions were introduced in 10g.

In your example, you can use the TRANSLATE function to remove the '#'
sign and see if the two strings are equivalent:

IF TRANSLATE(str_a,'#','') = TRANSLATE(str_b,'#','') THEN ....

HTH,
Brian
--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown

--
Posted via a free Usenet account from http://www.teranews.com



Reply With Quote
  #3  
Old   
Fester Bestertester
 
Posts: n/a

Default Re: String Comparisons in Oracle 9i - 10-22-2007 , 02:38 PM



Brian Peasland wrote:
Quote:
Regular expressions were introduced in 10g.

In your example, you can use the TRANSLATE function to remove the '#'
sign and see if the two strings are equivalent:

IF TRANSLATE(str_a,'#','') = TRANSLATE(str_b,'#','') THEN ....
Right...I had a feeling that's what I would need to do. thanks for
responding.


Reply With Quote
  #4  
Old   
DA Morgan
 
Posts: n/a

Default Re: String Comparisons in Oracle 9i - 10-22-2007 , 03:24 PM



Fester Bestertester wrote:
Quote:
Greetings,

We are using Oracle 9i. Are regexp functions available in Oracle 9i, or
was that introduced with 10?

Given the following two strings:
str_a='5838 MISSION CENTER RD #C'
str_b='5838 MISSION CENTER RD C'

or
str_a='7576 PARKWAY DR APT #2A'
str_b='7576 PARKWAY DR APT 2A'

is it possible to write an expression in Oracle 9i that will return true
if the only difference between the two strings is the presence of the
'#' symbol?
Regular expressions have been available since version 8 in the
OWA_PATTERN package.
http://download.oracle.com/docs/cd/B...tt.htm#i999925
Not nearly as fast or robust as the 10g implementation but they are there.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org


Reply With Quote
  #5  
Old   
Fester Bestertester
 
Posts: n/a

Default Re: String Comparisons in Oracle 9i - 10-22-2007 , 03:42 PM



DA Morgan wrote:
Quote:
Regular expressions have been available since version 8 in the
OWA_PATTERN package.
http://download.oracle.com/docs/cd/B...tt.htm#i999925

Not nearly as fast or robust as the 10g implementation but they are there.
Oh, very cool! Now there's something I didn't know. I may not end up
using it right away, but it's good to know about anyway. Thanks.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.