Home » SQL & PL/SQL » SQL & PL/SQL » Longest word PL SQL
Longest word PL SQL [message #611261] Mon, 31 March 2014 19:42 Go to next message
Ben892
Messages: 1
Registered: March 2014
Location: Morocco
Junior Member
I have to write a stored function to find the longest word in a string
characters. IN PL/SQL
Can someone help me?
Re: Longest word PL SQL [message #611262 is a reply to message #611261] Mon, 31 March 2014 19:45 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Welcome to this forum.

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and please read http://www.orafaq.com/forum/t/174502/102589/


We don't do homework.
Re: Longest word PL SQL [message #611268 is a reply to message #611261] Tue, 01 April 2014 00:10 Go to previous messageGo to next message
Michel Cadot
Messages: 68648
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Solution depends on your Oracle version.
Have a look at regexp_substr and search for "varying in-list".
You can also read http://www.orafaq.com/forum/mv/msg/95011/569066/#msg_569066

Re: Longest word PL SQL [message #611272 is a reply to message #611261] Tue, 01 April 2014 01:16 Go to previous message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
Using the regular expression functions would probably be the most elegant, and highest scoring, approach. A more clumsy technique would be to use SUBSTR in a loop from 1 to the length (LENGTH)of the string to read the string one character at time, counting the characters between spaces.
Previous Topic: 30 minute Time Interval
Next Topic: creating oracle tablespace and quotasize dynamically
Goto Forum:
  


Current Time: Tue May 07 13:55:32 CDT 2024