lundi 2 mars 2015

Using REGEXP_SUBSTR to get key-value pair data

I have a column with below values,



User_Id=446^User_Input=L307-60#/25" AP^^


I am trying to get each individual value based on a specified key.



  1. All value after User_Id= until it encounters ^

  2. All value after User_Input= until it encounters ^


I tried for and so far I have this,



SELECT LTRIM(REGEXP_SUBSTR('User_Id=446^User_Input=L307-60#/25" AP^'
,'[0-9]+',1,1),'^') User_Id
from dual


How do I get the value for the User_Input??


P.S: User input can have anything, like ',", *,% including a ^ in the middle of the string (that is, not as a delimiter).


Any help would be greatly appreciated..


Aucun commentaire:

Enregistrer un commentaire