Search code examples
oracle-databaseplsqloracle-apex

How to use apex_string.split?


I'm trying to split a string : OK#15#78 by #

I would like to get the first part of the string : Ok

I tried the following queries but it's not working :

select apex_string.split('OK#15#78','#')[0] from dual;

What can I try next?


Solution

  • You could use TABLE and rownum:

    SELECT val
    FROM (Select rownum AS rn, column_value AS val
         FROM TABLE(apex_string.split('OK#15#78','#')))
    WHERE rn = 1;