Oracle Database Is Function (IsDate, ...)

> Database > Oracle Database

1 - IsDate

CREATE OR REPLACE FUNCTION IsDate( p_str IN VARCHAR2, p_format IN VARCHAR2 ) RETURN NUMBER AS
V_date DATE;
BEGIN
    V_Date := TO_DATE( p_str, p_format );
    RETURN 1;
EXCEPTION
   WHEN OTHERS THEN
      RETURN 0;
END;

Example :

SELECT DATE_FROM 
FROM TABLE
WHERE ISDATE(DATE_FROM,'YYYYMMDD') = 1