Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUBSTR function to start at last character - 7

Status
Not open for further replies.

cuetzpalin

Programmer
Jun 5, 2002
99
US
Hello,

How would I use the substr function or a string function to start at the end of a field and extract 7 characters only?

Example:
1450204200201

I would only want: 4200201
the field varies in size from 7 - 11

Please help!

Thank you!

- Ed
 
Cuetzpalin,

You'll be amazed at how easy it is to display just the last 7 characters, regardless of the length of the original string:
Code:
select substr('1450204200201',-7) from dual;

SUBSTR(
-------
4200201

select substr('Of all of these characters, I want just the last 7s',-7) from dual;

SUBSTR(
-------
last 7s
Let us know how well you like this solution.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
“Beware of those that seek to protect you from harm or risk. The cost will be your freedoms and your liberty.”
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top