Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

last four digits of a number that has different lengths.

671312Feb 3 2010 — edited Feb 4 2010
I am using this but I have some emplid's that are only two numbers and it doesn't show them. I need the last four digits of the emplid, but I need to show any emplid's that have less than 4 numbers in it.
ap1.last_name || ' ' || LPAD(ap1.first_name,1) || ' ' || ap1.rate || ' ' || SUBSTR(TO_CHAR(pn.emplid),-4) AS crew_name
for example :
CREW Name EMPLID
COUTURE R AMTC 54
LUCKENBAUGH D AMT1 1701 1701
KEITHLY A AET1 9511 1099511

I need the top one to show the 54 after the rate even though it is less than 4 numbers in length.
Any ideas how to get it to show the 54 and the last four of any emplid that is more than 4 numbers in length?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2010
Added on Feb 3 2010
5 comments
2,697 views