Home > Mobile >  Extract date field from text in Oracle
Extract date field from text in Oracle

Time:06-09

I am trying to extract a date field from a text in Oracle SQL

Below is an example of 2 rows of the data. The data does not always match in length or content, but the date field is always in MM-DD-YYYY format

Name: JONES            01-01-2001      Marital St: SI
Name: GEORGE SMITH            01-02-1999

I tried using REGEXP_SUBSTR to only retrieve the date but I was unsuccessful. Is there any way the date can be extracted from this type of data? Thanks!

CodePudding user response:

Have you tried REGEXP_SUBSTR with this pattern?

\d{2}-\d{2}-\d{4}

Should work.

  • Related