Validating ssn

TRIM(TRANSLATE(blah.ssn, '0123456789',' ')) ! Just quickly scribbled the SQL just minutes before starting holiday, so if there's obvious SQL errors...Really, honest, I'm just wanting to verify that the string is composed of exactly nine numbers, and nothing else.

Is the input defined as "VARCHAR2(9)" or is the input defined as NUMBER(9)?NO_WHITE_SPACES_IN_VALIDATED) violated ' 12345678' 'Leading white space' ORA-02290: check constraint (SCOTT.NO_WHITE_SPACES_IN_VALIDATED) violated '12345678 ' 'Trailing white space' ORA-01722: invalid number '1234 5678' 'Contains white space' ORA-02290: check constraint (SCOTT.The reason I mention it is that it involves no code, just DDL, can be easily tested, and rerun time and again.I think these advantages are sufficient to warrant considering the use of a later version of Oracle.NINE_CHARACTERS_PRESENT) violated '12345678' 'Not enough characters' ORA-01722: invalid number '00001exp2' 'Valid number - not nine digits' I omitted some of the columns from the error report due to the width of the page being limited and for clarity.However, you can see that oracle will automatically list each and every error for you, with no effort on your part.It then returns that string as a NUMBER value if it is a valid number.It the string is not a valid number, the function returns a NULL.For your protection, we do not store any social security number entered on this page.This should return '9' for valid SSN's, and something else for invalid SSN's. Before I do, wanted to see if there might be a better way to accomplish this.

509 comments

  1. Hive Multi-Validating Self Textbox Control Hive multi-validating self textbox control. SSN Allows social

  2. This code sample shows how to test if a string corresponds to predefined format examplewith SSN and chemical element name. Python re module used for regular

  3. Free Chat Rooms, Massive list of great interactive java and flash chat rooms, we covera big area of online chatting interests such as, Teen Chat.

Leave a Reply

Your email address will not be published. Required fields are marked *

*