SQL Fiddle
Настройка схемы Oracle 11g R2 :
CREATE TABLE table1 ( column1 VARCHAR2(100) );
INSERT INTO table1 VALUES ( 'some_string Date: 00:30 05/16/2018 ' );
Запрос 1 :
MERGE INTO table1 dst
USING (
WITH split ( rid, prefix, dt ) AS (
SELECT ROWID,
SUBSTR( column1, 1, INSTR( column1, 'Date: ' ) + 5 ),
SUBSTR( column1, INSTR( column1, 'Date: ' ) + 6 )
FROM table1
WHERE INSTR( column1, 'Date: ' ) > 0
),
converted_dts ( rid, prefix, dt ) AS (
SELECT rid,
prefix,
CASE
WHEN REGEXP_LIKE( dt, '^\s*\d?\d:\d\d \d?\d([/-])\d?\d\1\d{1,4}\s*$' )
THEN TO_DATE( dt, 'HH24:MI MM/DD/YYYY' )
WHEN REGEXP_LIKE( dt, '^\s*\d?\d([\-])(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NO|DEC)\1\d{1-4})\s*%' )
THEN TO_DATE( dt, 'DD-MON-YYYY' )
END
FROM split
)
SELECT rid,
prefix,
TO_CHAR( dt, 'HH24:MI:ss MM/DD/YYYY' ) AS dt
FROM converted_dts
WHERE dt IS NOT NULL
) src
ON ( dst.ROWID = src.RID )
WHEN MATCHED THEN
UPDATE
SET column1 = prefix || dt
Результаты
Запрос 2 :
SELECT *
FROM table1
Результаты :
| COLUMN1 |
|---------------------------------------|
| some_string Date: 00:30:00 05/16/2018 |