samedi 2 juillet 2016

How to extract multiple dates from varchar2(4000) multiline string using sql?

I have two columns ID (NUMBER), DESCRIPTION (VARCHAR2(4000)) in original table

DESCRIPTION column has multi line strings.

I need to extract dates from each line of the string and also need to find earliest date. so the result would look like in expected result table.

Origional result:
Origional result

Expected Table:
Expected Table Using this query:

to_date((regexp_substr(A.Description , 'd{1,2}/d{1,2}/d{4}')), 'MM-DD-YYYY')

I was able to extract date from the first line

Discontinued:09/10/2015:Rappaport Family Institute for Research:;

only, but not from the other two.

Aucun commentaire:

Enregistrer un commentaire