sql - 如何在Oracle中将`(Ab56.12345)some_string`的一列字符串拆分为两列`Ab.12345`,`some_string`并加入原始表?
问题描述
作为问题,
如何将一列字符串拆分(Ab56.12345)some_string
为两列Ab56.12345
并some_string
在Oracle中?
注意:不是所有的列都是(Ab56.12345)some_string
,部分列只有some_string
没有(Ab56.12345)
,两列是null
和some string
如何查询以下SQL中的所有记录?我只能查询一条记录,但如果所有记录,那是愚蠢的 SQL,我可以在下表中有一id
列t1
吗?
SELECT DISTINCT * FROM
(with test (col) as
(select test_name from test_table WHERE id = '111222')
select REGEXP_SUBSTR(col, '\((.+?)\)', 1, 1, NULL, 1) code,
REGEXP_REPLACE(col, '\(.+?\)', '') name,
col
from test) t1, test_table t2 WHERE t2.id = '111222' and t1.COL=t2.test_name
解决方案
推荐阅读
- alexa-presentation-language - Alexa 模拟器中的 OpenUrl 命令
- python - Pandas groupby 基于列值
- mysql - MySQL:检查一个表中的列数与第二个表的列中的值
- wpf - 如何将 CollectionViewSource 绑定到 DataGrid
- javascript - 不能将两个存储 offsetHeight 的变量加在一起
- selenium - 使用带有 Selenium 的 Xpath 进行复选框
- flutter - 在颤动中获取“文件$”而不是文件
- jenkins - jenkins executor 自动重置一段时间,通过 kubernetes 方式部署
- group-by - Dax 度量来计算一组完整表中的最小值
- r - 如何在 r 中使用 k-mean 划分区域?