Home » SQL & PL/SQL » SQL & PL/SQL » Find the number 3 in the third and last digits of an SSN (oracle 11g)
Find the number 3 in the third and last digits of an SSN [message #621007] 
Thu, 07 August 2014 11:46 
tuckersuz
Messages: 26 Registered: July 2009

Junior Member 


Hello:
This is a quick question someone might be able to answer quickly, since I didn't see it on any other posts. What is an easy way to find the number 3 in the third and last digits of a Social Security Number,without dashes, keeping in mind that an SSN may be 8 digits long (since the SSN can start with a zero) or 9 digits long?
Thanks




Re: Find the number 3 in the third and last digits of an SSN [message #621011 is a reply to message #621007] 
Thu, 07 August 2014 12:48 

EdStevens
Messages: 520 Registered: September 2013

Senior Member 


tuckersuz wrote on Thu, 07 August 2014 11:46Hello:
keeping in mind that an SSN may be 8 digits long (since the SSN can start with a zero) or 9 digits long?
Actually, you just hit on an important concept concerning data type.
In truth, SSN is NOT a number. It is a character string which, by usage specification, is limited to only those characters that we also use to represent numbers.
In a true number, leading zeros are nonsignificant. That's why, in the treatment of numbers, they are dropped. In a SSN, being a code and not a number, that leading zero is very much significant.
And as a result of the above, storing an SSN as a NUMBER data type is just as wrong as storing a number or a date as a CHARACTER data type, or storing a date as a NUMBER data type.
Look at the nature of the data, not its character representation, and store it in the appropriate data type.






Goto Forum:
Current Time: Thu Nov 26 17:33:55 CST 2015
Total time taken to generate the page: 0.27186 seconds
