Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Query - Extract Middle name

690375Mar 11 2009 — edited Mar 11 2009
I am still in training and have a scenario where I need to extract the middle name ONLY out of a table 'EMP'. Using Toad I have currently gotten this far:

bq. SELECT SUBSTR(ENAME,1,INSTR(ENAME,' ',1,1)-1)FIRSTNAME, \\ SUBSTR(ENAME,INSTR(ENAME,' ',1,1)+1),(INSTR(ENAME,' ',1,2)-INSTR(ENAME,' ', 1,1)-1)MIDDLENAME, \\ SUBSTR(ENAME,INSTR(ENAME,' ',1,2)+1)LASTNAME \\ FROM EMP;
The data is in the following format:
bq. 'John William Edwards'
Can some one please help me with this? If possible I would like an explanation as well so I can understand.

Thanks!

Edited by: javeriac@gmail.com on Mar 11, 2009 9:49 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2009
Added on Mar 11 2009
8 comments
2,683 views