Home » SQL & PL/SQL » SQL & PL/SQL » Validating a Social Security Number
Validating a Social Security Number [message #7354] Fri, 06 June 2003 12:14 Go to next message
Mel
Messages: 7
Registered: May 2002
Junior Member
I have a variable (SSN_NUM) declared as VARCHAR2(15). I would like to validate this variable to confirm it only contains numbers 0-9. Is there a built-in that would do this?

Thanks!!
Mel
Re: Validating a Social Security Number [message #7355 is a reply to message #7354] Fri, 06 June 2003 13:12 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
replace(translate(ssn_num, '0123456789', '0'), '0') is null


indicates only numbers. Change to IS NOT NULL to identify any values with non-numerics.
Previous Topic: recursive search
Next Topic: Error when comparing varchar Invalid Number and number columns
Goto Forum:
  


Current Time: Tue Apr 23 22:19:25 CDT 2024