oracle中如何替换特殊字符然后换行

编程入门 行业动态 更新时间:2024-10-27 17:15:05
本文介绍了oracle中如何替换特殊字符然后换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这就是我在 Oracle 12c 中获得结果的方式

This is how I am getting result in Oracle 12c

ID日期范围
1[2019-01-07"、2019-02-17"、2019-03-17"]

我想要

ID日期范围
12019-01-07
12019-02-17
12019-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中如何替换特殊字符然后换行

本文发布于:2023-10-24 15:04:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524259.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:换行   特殊字符   oracle

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!