-1

I need to split a string based on a key in PL/SQL.

strCode:=empcode:empname:empcontactno;

strval:=101:John:9345723;

I have to write a generic function to split the strval based on the strCode and populate separate variables such var_empcode, var_empname,var_empcontactno for a bunch of records.

Split based on the delimiter is simple enough, but split based on key and populating corresponding variables is tricky, because the strCode is configurable and the function has to be generic to accomodate future changes in the strCode.

Kindly let me know if there is an easy way to work this one out. Thanks.

Bruce_Wayne
  • 1,564
  • 3
  • 18
  • 41
Geethapriya.VC
  • 133
  • 1
  • 6
  • 14

1 Answers1

-1

For this you can use php explode() function.

<?php 
   $result = explode(':', Your_Array);
?>

this gives you an array like below

array(
  [0] =>empcode,
  [1] =>empname,
  [2] =>empcontactno
)

and you will get these value by using keys.

Bruce_Wayne
  • 1,564
  • 3
  • 18
  • 41
SuReSh
  • 1,503
  • 1
  • 22
  • 47