Home » SQL & PL/SQL » SQL & PL/SQL » How to find last three letter of a word
How to find last three letter of a word [message #300143] Thu, 14 February 2008 07:14 Go to next message
AnamikaChaudhary
Messages: 33
Registered: December 2007
Location: Mumbai
Member
Hi,
i have an employee table, from that i want to get the last three letter of employee_name column.

suppose i have

king--------- ing(this is the result i want)
smith--------ith
miller-------ler


thanks

please help me
Re: How to find last three letter of a word [message #300147 is a reply to message #300143] Thu, 14 February 2008 07:25 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Look up the syntax for substr.
By the way, really, really, really NOT an expert question

[Updated on: Thu, 14 February 2008 07:25]

Report message to a moderator

Re: How to find last three letter of a word [message #300150 is a reply to message #300147] Thu, 14 February 2008 07:35 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
moved
Re: How to find last three letter of a word [message #300261 is a reply to message #300143] Thu, 14 February 2008 15:23 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What would you like to return if name is shorter than 3 characters? For example, 'Yo'?
Re: How to find last three letter of a word [message #300262 is a reply to message #300143] Thu, 14 February 2008 15:30 Go to previous messageGo to next message
coleing
Messages: 213
Registered: February 2008
Senior Member
This is probably what you need.

select substr(employee_name,-3)
from table_name;
Re: How to find last three letter of a word [message #300289 is a reply to message #300262] Thu, 14 February 2008 22:40 Go to previous messageGo to next message
AnamikaChaudhary
Messages: 33
Registered: December 2007
Location: Mumbai
Member
Hi,
It works..
Thanx
Re: How to find last three letter of a word [message #300294 is a reply to message #300262] Thu, 14 February 2008 23:01 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
@coleing

Once again, please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code.
Use the "Preview Message" button to verify.

Don't put solution only hint or clue as requested in OraFAQ Forum Guide, "Responding to Posts" section:
Quote:
When responding to questions, if it is obviously a student with a homework assignment or someone else just learning, especially in the homework and newbies forums, it is usually best to provide hints or clues, perhaps links to relevant portions of the documentation, or a similar example, to point them in the right direction so that they will research and experiment on their own and learn, rather than providing complete solutions to problems. In cases where someone has a real-life complex work problem, or at least it may seem complex to them, it may be best to provide a complete demo and explanation.


Regards
Michel
Previous Topic: calculating business days considering organizations own holidays
Next Topic: Replacing Special Character
Goto Forum:
  


Current Time: Sat Dec 03 11:51:17 CST 2016

Total time taken to generate the page: 0.07485 seconds