SELECT set_act_id_1,
TO_DATE( REGEXP_SUBSTR( set_act_id_1, '[^+]+', 1, 6 ), 'DD-MM-YYYY' )
FROM STAGE.CUSTOMERS
WHERE set_act_id_1 is not null
Lub
SELECT set_act_id_1,
TO_DATE( SUBSTR( set_act_id_1, INSTR( set_act_id_1, '+', 1, 5 ) + 1 ), 'DD-MM-YYYY' )
FROM STAGE.CUSTOMERS
WHERE set_act_id_1 is not null
Aktualizacja :
SELECT CASE
WHEN REGEXP_LIKE( expiry_date, '^\d{1,2}[ \/-](JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)[ \/-]\d{4}$', 'i' )
THEN TO_DATE( expiry_date, 'dd mon yyyy' )
WHEN REGEXP_LIKE( expiry_date, '^\d{1,2}[ \/-](JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)[ \/-]\d{2}$', 'i' )
THEN TO_DATE( expiry_date, 'dd mon yy' )
WHEN REGEXP_LIKE( expiry_date, '^(0?[1-9]|[12]\d|3[01])[ \/-](0?[1-9]|1[0-2])[ \/-]\d{4}$' )
THEN TO_DATE( expiry_date, 'dd mm yyyy' )
WHEN REGEXP_LIKE( expiry_date, '^(0?[1-9]|1[0-2])[ \/-](0?[1-9]|[12]\d|3[01])[ \/-]\d{4}$' )
THEN TO_DATE( expiry_date, 'mm dd yyyy' )
WHEN REGEXP_LIKE( expiry_date, '^(0?[1-9]|[12]\d|3[01])[ \/-](0?[1-9]|1[0-2])[ \/-]\d{2}$' )
THEN TO_DATE( expiry_date, 'dd mm yy' )
WHEN REGEXP_LIKE( expiry_date, '^(0?[1-9]|1[0-2])[ \/-](0?[1-9]|[12]\d|3[01])[ \/-]\d{2}$' )
THEN TO_DATE( expiry_date, 'mm dd yy' )
ELSE NULL
END AS expiry_date
FROM (
SELECT set_act_id_1,
SUBSTR( set_act_id_1, INSTR( set_act_id_1, '+', 1, 5 ) + 1 ) As expiry_date
FROM STAGE.CUSTOMERS
WHERE set_act_id_1 is not null
)