sql - Checking format of timestamp with time zone variable in oracle plsql -


i need create oracle plsql script have input param v_date timestamp time zone type. need verify whether format of v_date per mentioned format 'yyyy-mm-dd hh24:mi:ss tzh:tzm' or not . how should achieve this?

i thinking of achieveing changing input param v_date string , convert string timestamp time zone , if error occured while converting conclude format wrong. seems to_timestamp_tz functions doesn't throw error when date string in different format w.r.t specified format instead converts it.

for e.g.

select to_timestamp_tz('15-apr-15',    'yyyy-mm-dd hh:mi:ss tzh:tzm') dual; 

actual result : 14-apr-15 11.50.00.000000000 pm america/chicago

expected result : some error format not per 'yyyy-mm-dd hh:mi:ss tzh:tzm'

in short want know how verify format of timestamp time zone type.

you try adding "fx" modifier format, says oracle "expect exact format":

select to_timestamp_tz('15-apr-15 ', 'fxyyyy-mm-dd hh:mi:ss tzh:tzm') dual;  select to_timestamp_tz('15-apr-15 ', 'fxyyyy-mm-dd hh:mi:ss tzh:tzm') dual                        * error @ line 1 ora-01862: numeric value not match length of format item 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -