Adeel Aslam
Adeel Aslam

Reputation: 1294

find comma in oracle sql string

I have a column in my oracle db as character and data stored in this is like here

30.170527093355002,72.615875338654 and
30.805165,71.82474

Now I want to get the separated by comma whole string. I mean I want to get the part of string before comma and also part after comma separately. Please any one tell me is there any built in function to do this that I can separate my while string by comma regardless of comma position where it exist.I have already tried floor function and substr but all in vain please help me to use any built in function or user defined function to full fill my requirements.

Upvotes: 1

Views: 17971

Answers (1)

Kelly
Kelly

Reputation: 3709

    select
      substr( COLNAME, 1, instr( COLNAME, ',') - 1 ) as p_1 ,
      substr( COLNAME, instr( COLNAME, ',', - 1 ) + 1 ) as p_2
    from YOURTABLE

Upvotes: 4

Related Questions