Search code examples
oracle-apexoracle-apex-5

How to trim non-numeric characters with APEX transformation


During importing a CSV file I want to transform one column with money values so that it will insert them into database without problem.

I have values such as "134,245.99 RUB" and the output should be "134,245.99" or "134245.99" at best.

I tried doing it using transformation but there is no documentation (sic!) on that subject from Oracle how to use it.

Do you have any ideas?


Solution

  • @tweant: You can use regexp_replace function and do this easily. Here's an example:

    select trim(regexp_replace(' 2345abc ','\D*$','')) as str from dual;
    

    This will remove all the non digit characters from the end and trim the white spaces.

    More information about the function here.