Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7552933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:54:42+00:00 2026-05-30T10:54:42+00:00

I am wanting to know if there is a way, in Oracle SQL, to

  • 0

I am wanting to know if there is a way, in Oracle SQL, to compare two strings for similarities other than = or like. For instance, SQL Server has a function difference(str1, str2) that compares the two strings and gives a similarity rating (0 to 4). Not exactly what I want but that would still be extremely helpful.

I was hoping specifically for functions or methods that would:

  1. Compare a string character by character (return the number of exact matches)
  2. Tell how many characters are in one string, but in the wrong place

The primary use would be for strings of same length, that contain numbers (IDs, phone numbers, etc.) For my purposes, I would use it to find possible matches in which letters/numbers may have been transposed. Soundex(string) works well for alpha strings but seems to ignores numbers (for good reason).

I do not have privileges to create functions on my own, but if someone knows a method of doing that I would interested in hearing it. One solution to compare char-to-char (that only works if you know the MAX number of characters) is:

 --For char-to-char counts
    Decode(substr(ID1,1,1),  substr(ID2,1,1), 1,  0) +
    Decode(substr(ID1,2,1),  substr(ID2,2,1), 1,  0) +
    [...]
    Decode(substr(ID1,N,1),  substr(ID2,N,1), 1,  0)

But that is about as inelegant as you can get.

Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:54:44+00:00Added an answer on May 30, 2026 at 10:54 am

    It sounds like you’re looking for the UTL_MATCH package

    SELECT utl_match.edit_distance( string1, string2 )
      FROM dual
    

    tells you the number of edits required to transform string1 into string2

    SQL> select utl_match.edit_distance( 'Bear', 'berry' ) from dual;
    
    UTL_MATCH.EDIT_DISTANCE('BEAR','BERRY')
    ---------------------------------------
                                          3
    

    There are also a couple of similarity functions EDIT_DISTANCE_SIMILARITY and JARO_WINKLER_SIMILARITY that give similarity scores between 0 and 100 that give you an idea of how similar the strings are.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wanting to know if there is any way to have multiple footer
I would like to know if there is any way to add custom behaviour
I'm wanting to know if there's a way I can transform my view to
I was wanting to know if there is a good way to work in
I've been wanting to know if there's a good, jQuery-esque way to do the
Is there any way of telling, using C#, if the Sql Server I'm connected
I am wanting to find the distance between two different points. This I know
With oracle currently there is a way to call a database through a command
I'm wanting to know what the best way to go about creating a list
hey all. Just wanting to know is this the most efficient way of getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.