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!

using Substr and Instr together

750906Jun 27 2010 — edited Jun 28 2010
Hi All,

I have a string like 'Employee_id,employee_name,employee_ssn,employee_ps'

I would like to extract all the four columns individually in a single statement.
For ex:

select SUBSTR('Employee_id,employee_name,employee_ssn,employee_ps',1,
INSTR('Employee_id,employee_name,employee_ssn,employee_ps',',',1,1)-1) from dual;

this gives me Employee_id. The same way how do i get the other coulmn names by comma position.

Pls help me out.

Please note that the column names have to be extracted depending on the comma position.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2010
Added on Jun 27 2010
3 comments
3,738 views