SELECT id,
TO_NUMBER(REGEXP_SUBSTR(schedule_name, '(\d+\.?\d*)\s+hrs', 1, 1, 'i', 1)) AS hrs
FROM table_name
其中,对于示例数据:
CREATE TABLE table_name (id, schedule_name) AS
SELECT 1, 'IPFGH Cycle 2 Work Schedule 7.78 hrs - 30 min lunch - 07:15:00 AM to 03:32:00 PM Work Time' FROM DUAL UNION ALL
SELECT 2, 'IPFGH Cycle 1 Work Schedule 7.78 hrs - 60 min lunch - 08:00:00 AM to 04:47:00 PM Work Time' FROM DUAL UNION ALL
SELECT 3, 'IPFGH Cycle 1 Work Schedule 7.78 hrs - 30 min lunch - 07:47:00 AM to 04:04:00 PM Work Time' FROM DUAL UNION ALL
SELECT 4, 'IPFGH Cycle 2 Work Schedule 7.78 hrs - 60 min lunch - 06:45:00 AM to 03:32:00 PM Work Time' FROM DUAL UNION ALL
SELECT 5, 'IPFGH Part Time WTF Cycle Work Schedule No EDO 7 hrs - 60 min lunch - 08:00:00 AM to 04:00:00 PM Work Time' FROM DUAL;
1条答案
按热度按时间dz6r00yl1#
您可以使用
REGEXP_SUBSTR
:其中,对于示例数据:
输出:
| ID|HRS|
| --------------|--------------|
| 1|七点七八分|
| 二|七点七八分|
| 三|七点七八分|
| 四|七点七八分|
| 五|七|
fiddle