pvsbandi
asked on
Query for Last 4 social
I know it's very simple but i'm missing something here..kindly help.
I have a query like this :
select SUBSTR (CHAR ((DIGITS (ssn_no))), 1, 9) as ssn_no
from tb_ssn
which works fine.Now the requirement is to get only the last 4 digits of ssn.So, i tried the following and got an error.
select SUBSTR (CHAR ((DIGITS (ssn_no))), 5, 9) as ssn_no
from tb_ssn
What am i missing? Please advise.
I have a query like this :
select SUBSTR (CHAR ((DIGITS (ssn_no))), 1, 9) as ssn_no
from tb_ssn
which works fine.Now the requirement is to get only the last 4 digits of ssn.So, i tried the following and got an error.
select SUBSTR (CHAR ((DIGITS (ssn_no))), 5, 9) as ssn_no
from tb_ssn
What am i missing? Please advise.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ha--There it is!! Thanks much!
hi
usually i don't do this,
but may i ask why you graded it with B and not A ?
usually i don't do this,
but may i ask why you graded it with B and not A ?
select right(SUBSTR (CHAR ((DIGITS (ssn_no))), 1, 9) ,4 ) as ssn_no
from tb_ssn