Oracle 11g
Hi All
I appreciate if someone help me out, my requirement is that to create a function that will accept a value and check that this value should be date format and if yes then return true other wise return false. So far, I created the below function but its not working...
Code for function
FUNCTION is_valid_date_format (
p_format IN date )
RETURN BOOLEAN IS
l_date VARCHAR2(100) := NULL;
BEGIN
l_date := TO_char( p_format, 'MON-YYYY' );
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
RETURN FALSE;
END is_valid_date_format;
---Function execution
SELECT is_valid_date_format(TO_DATE('APR-2016','MON-YYYY') ) FROM DUAL;
Error
ORA-06552: PL/SQL: Statement ignored
ORA-06553: PLS-382: expression is of wrong type
06552. 00000 - "PL/SQL: %s"
*Cause:
*Action:
Error at Line: 5 Column: 12
Please guide.