I need to create a oracle plsql script which have input param v_date as Timestamp with time zone type. Also I need to verify whether the format of the v_date is as per mentioned format 'YYYY-MM-DD HH24:MI:SS TZH:TZM' or not . How should I achieve this?
I was thinking of achieveing this by changing input param v_date as String and then convert this string into Timestamp with time zone and if any error occured while converting then conclude that the format is wrong. But it seems TO_TIMESTAMP_TZ functions doesn't throw error when the date string is in different format w.r.t the specified format instead it converts it.
For e.g.
SELECT TO_TIMESTAMP_TZ('15-APR-15',
'YYYY-MM-DD HH:MI:SS TZH:TZM') FROM DUAL;
Actual result : 14-APR-15 11.50.00.000000000 PM AMERICA/CHICAGO
Expected result : Some error as format is not as per 'YYYY-MM-DD HH:MI:SS TZH:TZM'
In short I want to know how to verify the format of Timestamp with time zone type.