Results 1 to 4 of 4

Thread: Soundex

  1. #1
    Contributing Member
    Join Date
    Mar 2008
    Answers
    66

    Soundex

    Why SOUNDEX('1') returns NULL value?


  2. #2
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: Soundex

    Quote Originally Posted by babi_geek View Post
    Why SOUNDEX('1') returns NULL value?

    If you have an alpha character soundex returns a value otherwise returns a null.
    Code:
    SQL> SELECT SOUNDEX('123456') FROM DUAL;
    
    S
    -
                      <- OUTPUT NULL
    
    SQL> SELECT SOUNDEX('1234X') FROM DUAL;
    
    SOUN
    ----
    X000
    SQL> SELECT SOUNDEX('A23333') FROM DUAL;
    
    SOUN
    ----
    A000


    Last edited by krishnaindia2007; 06-04-2008 at 05:55 AM.

  3. #3
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: Soundex

    Here is a beautiful example based on the above point.


    How to select only Numeric values from the following table containing alphanumeric data?

    Code:
       
      CREATE TABLE MY_TABLE
         (
          TEST   VARCHAR2(3)
          );
    
     INSERT INTO MY_TABLE VALUES('1');
     INSERT INTO MY_TABLE VALUES('2');
     INSERT INTO MY_TABLE VALUES('2a');
     INSERT INTO MY_TABLE VALUES(‘3a’);
    
      COMMIT;
    
     
     My required output is 
     1
     2
    
    Query is 
    SQL> SELECT test
         FROM   my_table
         WHERE  soundex(test) IS NULL;
    
    TEST
    ---
    1
    2
    
    
    DROP TABLE MY_TABLE;



  4. #4
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Soundex

    Rules For Soundx:

    Retain the first letter of the string and remove all other occurrences of the following letters: a, e, h, i, o, u, w, y

    Assign numbers to the remaining letters (after the first) as
    follows:
    b, f, p, v = 1
    c, g, j, k, q, s, x, z = 2
    d, t = 3
    l = 4
    m, n = 5
    r = 6

    If two or more letters with the same number were adjacent in the original name (before step 1), or adjacent except for any intervening h and w, then omit all but the first.

    Return the first four bytes padded with 0.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact