Solved

SSN Format in Oracle

Posted on 2016-09-15
2
58 Views
Last Modified: 2016-09-21
I'm using the following code to format the ssn#s :
to_char(replace(emp.fica_nbr,'-'),999999999) SSNBR

The only issue is if a ssn# starts with 0, it is being omitted.
How can I adjust the code to capture all numbers, even if the leading one is a 0?
0
Comment
Question by:metalteck
  • 2
2 Comments
 
LVL 34

Expert Comment

by:johnsone
Comment Utility
What is the TO_CHAR for?  It is already a character field.  You just need to remove the -

replace(emp.fica_nbr,'-') SSNBR
0
 
LVL 34

Accepted Solution

by:
johnsone earned 500 total points
Comment Utility
If you insist on the TO_CHAR, then this would do it, but you are doing a lot of unnecessary conversion.

to_char(to_number(replace(emp.fica_nbr,'-')),'000000000')
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Query 18 80
Export BLOB data from Oracle 10g 4 23
Dataware house query tuning 9 28
Oracle -- identify blocking session 24 22
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now