Hello All
I am running into an issue for Date validation as I am not able to get the desired bad dates out. The dates are in YYMMDD (VARCHAR2) format.
The last two dates are not failing.
. I would appreciate if any one of you expert can help in resolving this. The Date columns are repeated multiple time in my table.
SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 4 09:31:26 2016
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing option
WITH Src
AS (SELECT '001212' Dt FROM DUAL
UNION
SELECT '1$1212' Dt FROM DUAL
UNION
SELECT '1212#2' Dt FROM DUAL
UNION
SELECT '150231' Dt FROM DUAL
UNION
SELECT '150431' Dt FROM DUAL)
SELECT *
FROM Src
WHERE NOT REGEXP_LIKE (Dt, '^([0-9]{2})(0[1-9]|1[0-2])([012][1-9]|10|20|30|31)$')
I know there are lots of places dates are validated if any body can help me in resolve in validating the date..
Thanks in Advance.
Rajesh