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!

help required in the Substr and instr functions.

978485Jul 14 2014 — edited Jul 21 2014

Hi Gurus ,


Kindly help , Your suggestion is greatly appreciated.

I have the record's in a CSV file in the below format and looking to assign each column value to a variable for updating purpose.

Sample CSv file format:

199999424051,PMN Nash1,Nash 1 PMN
42345814,CDH - Local Palau,add - not for use


1)So when i have the below select run from dual  , it returns the first  column value.

select  substr('199999424051,PMN Nash1,Nash 1 PMN',1,instr('199999424051,PMN Nash1,Nash 1 PMN',',',1,1)-1) from dual

---199999424051

2)using the below gives me 3rd column value.

select  (substr('199999424051,PMN Nash1,Nash 1 PMN',instr('199999424051,PMN Nash1,Nash 1 PMN',',',2,2)+1)) from dual


3)please suggest how to get the 2nd column value from this.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2014
Added on Jul 14 2014
4 comments
1,335 views