If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Ambiguous soundex results

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-29-11, 06:36
ABisht ABisht is offline
Registered User
 
Join Date: Nov 2011
Posts: 4
Question Ambiguous soundex results

Hello everyone,

I am using DB2 SOUNDEX function, it works fine for me except in case i am passing a single character numeric value such as in following example

Select SOUNDEX('1') from SYSIBM.SYSDUMMY1;

Output Values are random such as
'.121' -- Execution 1
'.122' -- Execution 2
'.621' -- Execution 3

I get different values on executing the same statment multilpe times.

Please help me in ensuring that result always comes out same for above query. Also i am very interested in finding out why DB2 is behaving this way?

Appreciate any help

Much Thanks,
AB
Reply With Quote
  #2 (permalink)  
Old 11-29-11, 07:31
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
ABisht, what Edition, Version of DB2 are you using? I just tried your statement on DB2 z/OS v9 and DB2 Express-C LUW V9.7 and returned 'Z000' every time on both systems. I processed the query in QMF on z/OS and Command Editor on LUW.
Reply With Quote
  #3 (permalink)  
Old 11-29-11, 21:48
ABisht ABisht is offline
Registered User
 
Join Date: Nov 2011
Posts: 4
Reply for Stealth_DBA

Stealth_DBA

We are using DB2 Version 9.1 for z/OS. If i code my query as

SELECT SOUDEX(1) FROM SYSIBM.SYSDUMMY1;

I always get result as Z000, but when i code it as

SELECT SOUDEX('1') FROM SYSIBM.SYSDUMMY1;

results differ.
Reply With Quote
  #4 (permalink)  
Old 11-29-11, 22:34
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
If you consider the soundex algorithm, you'll probably find that it is defined only for alphabetic characters. Subsequently, for numeric (non-alphabetic) characters its result is undefined, which is exactly what you are seeing.
Reply With Quote
  #5 (permalink)  
Old 11-29-11, 22:38
ABisht ABisht is offline
Registered User
 
Join Date: Nov 2011
Posts: 4
Reply for N_I

Thanks N_I,

Any solutions to avoid this undefined result set.
Reply With Quote
  #6 (permalink)  
Old 11-29-11, 22:54
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by ABisht View Post

Any solutions to avoid this undefined result set.
I see two:
- don't use the soundex algorithm
- supply only alphabetic characters to soundex()
Reply With Quote
  #7 (permalink)  
Old 11-29-11, 22:58
ABisht ABisht is offline
Registered User
 
Join Date: Nov 2011
Posts: 4
Reply for N_I

Thats an easy one but am not sure the desired one.

I will have to go back to bosses and discuss this further.

Thanks N_I for your replies. They have helped
Reply With Quote
Reply

Tags
db2 soundex

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On