我有數據,在一列的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
這不是工作,但是。我哪裏錯了?