如何在oracle中替换特殊字符然后换行
How to replace special characters and then break line in oracle
这就是我在 Oracle 12c 中获得结果的方式
Id
Date Range
1
[ "2019-01-07","2019-02-17","2019-03-17"]
而且我想要它
Id
Date Range
1
2019-01-07
1
2019-02-17
1
2019-03-17
我试过替换功能,但它在开头或结尾都有效
我想删除 [ ] 和“
由于您的 Oracle 版本是 12,您可以在当前输出上使用 JSON 函数来获得所需的输出。您当前的输出是一个有效的 JSON 字符串数组,您需要做的就是提取它们。像这样:
with
current_output (id, date_range) as (
select 1, '["2019-01-07","2019-02-17","2019-03-17"]' from dual
)
select co.id, t.date_range
from current_output co
cross apply
json_table(co.date_range, '$[*]' columns date_range path '$') t
;
ID DATE_RANGE
-- ---------------
1 2019-01-07
1 2019-02-17
1 2019-03-17
这就是我在 Oracle 12c 中获得结果的方式
Id | Date Range |
---|---|
1 | [ "2019-01-07","2019-02-17","2019-03-17"] |
而且我想要它
Id | Date Range |
---|---|
1 | 2019-01-07 |
1 | 2019-02-17 |
1 | 2019-03-17 |
我试过替换功能,但它在开头或结尾都有效 我想删除 [ ] 和“
由于您的 Oracle 版本是 12,您可以在当前输出上使用 JSON 函数来获得所需的输出。您当前的输出是一个有效的 JSON 字符串数组,您需要做的就是提取它们。像这样:
with
current_output (id, date_range) as (
select 1, '["2019-01-07","2019-02-17","2019-03-17"]' from dual
)
select co.id, t.date_range
from current_output co
cross apply
json_table(co.date_range, '$[*]' columns date_range path '$') t
;
ID DATE_RANGE
-- ---------------
1 2019-01-07
1 2019-02-17
1 2019-03-17