分数字符串

时间:2018-05-14 20:25:08

标签: oracle

我有这个

SELECT ('130.067'||'****') as "WIN " FROM DUAL ;

我需要在每个数字和*之间添加一个空格(“”)来得到像这样的东西

“1 3 0。0 6 7 * * * *”

1 个答案:

答案 0 :(得分:0)

SQL Fiddle

查询1

SELECT REGEXP_REPLACE(
         '130.067'||'****', -- String to match
         '([0-9.*])',       -- Match a digit or full stop or star
         ' \1',             -- Replace with space then matched character
         2                  -- Start at the 2nd character
       ) AS win
FROM   DUAL

<强> Results

|                   WIN |
|-----------------------|
| 1 3 0 . 0 6 7 * * * * |