我有数据,在一列的Oracle SQL正则表达式提取
+----------------------+
| my_column |
+----------------------+
| test_PC_xyz_blah |
| test_PC_pqrs_bloh |
| test_Mobile_pqrs_bleh|
+----------------------+
我如何可以提取以下为列如下?
+----------+-------+
| Platform | Value |
+----------+-------+
| PC | xyz |
| PC | pqrs |
| Mobile | pqrs |
+----------+-------+
我尝试使用REGEXP_SUBSTR
默认第一图案发生了platform
:
select regexp_substr(my_column, 'test_(.*)_(.*)_(.*)') as platform from table
获得第二图案发生了value
:
select regexp_substr(my_column, 'test_(.*)_(.*)_(.*)', 1, 2) as value from table
这不是工作,但是。我哪里错了?