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!

Reterving 2nd word from a column

473610Jul 5 2006 — edited Jul 5 2006

Hi,

Is it possible to reterive the SECOND word from a column contaning a statment, I tried it was working only to fetch the first word, But my requriment is to get the second word. Can anyone help me out in this issue.

EG :
Col_A
Hello man where r u
Wht is it
hello sir

Output:
man
is
sir.
**************************************************************************
The following is the query i tried

SELECT SUBSTR (a, 1, INSTR (TRIM (a), ' '))
FROM (SELECT c2311_question_library_id,
SUBSTR (CONCAT (c2311_question_long_txt, CHR (64)),
INSTR (c2311_question_long_txt, '@') + 1,
LENGTH (CONCAT (c2311_question_long_txt, CHR (64)))
) AS a
FROM t2311_survey_questions
WHERE ROWNUM < 50);

 
Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 2 2006
Added on Jul 5 2006
7 comments
473 views