SUBSTR and LPAD [message #490205] |
Fri, 21 January 2011 16:22  |
 |
goody
Messages: 14 Registered: January 2011 Location: Maryland
|
Junior Member |
|
|
Hello,
I have a table with last names of different lengths. I want to substr off the last 3 characters of the last name. Is there a way of doing it without me having to left pad the last name field then, creating another temp table, then substr off the last 3 characters.
Any help would be greatly appreciated.
|
|
|
Re: SUBSTR and LPAD [message #490208 is a reply to message #490205] |
Fri, 21 January 2011 16:40   |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
goody wrote on Fri, 21 January 2011 23:22I want to substr off the last 3 characters of the last name. Is there a way of doing it without me having to left pad the last name field then, creating another temp table, then substr off the last 3 characters.
Yes, simply use SUBSTR function with negative (-3) position parameter.
Oracle SQL language is documented in SQL Reference book, which is available e.g. online on http://tahiti.oracle.com/ Please, consult it.
|
|
|
|
|