本文介绍了oracle中如何替换特殊字符然后换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这就是我在 Oracle 12c 中获得结果的方式
This is how I am getting result in Oracle 12c
1 | [2019-01-07"、2019-02-17"、2019-03-17"] |
我想要
1 | 2019-01-07 |
1 | 2019-02-17 |
1 | 2019-03-17 |
我尝试了替换功能,但它在开始或结束时都有效我想删除 [ ] 和 "
I tried replace function but it works either at the beginning or at end I want to remove [ ] and "
推荐答案由于您的 Oracle 版本是 12,您可以在当前输出上使用 JSON 函数来获得所需的输出.您当前的输出是一个有效的 JSON 字符串数组,您需要做的就是提取它们.像这样:
Since your Oracle version is 12, you can use JSON functions on your current output to get the desired output. Your current output is a valid JSON array of strings, all you need to do is to extract them. Something like this:
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中如何替换特殊字符然后换行
发布评论