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!

PL/SQL string function 1

Status
Not open for further replies.

malaygal

IS-IT--Management
Feb 22, 2006
192
US
Does Oracle has left and right string function.
I need to extract the 2nd to the last character of a string as part of my WHERE clause in a sql string similar to this :

...where left(right(ucase(name),2)l,1) = '2'

Any help will be greatly appreciated.
 
Hi
use substr
Code:
select substr('abcdef',length('abcdef')-1,1) from dual;
 
A little simpler:
Code:
select substr('abcdef',-2,1) from dual;
 
Cool, Carp! The tightest, simplest code of all (WDITOT)...Please accept this
star.gif
for your cleverness!

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top