@cm right now i am using when_validate_trigger i.e
IF LENGTH(:GENERATE.FIN_YEAR)<>7
--and SUBSTR(:GENERATE.FIN_YEAR,5,1)<>'-'
THEN
MESSAGE ('Enter Financial Year in YYYY-MM Format');
MESSAGE('Enter Financial Year in YYYY-MM Format');
RAISE FORM_TRIGGER_FAILURE;
END IF;
IF SUBSTR(:GENERATE.FIN_YEAR,5,1)<>'-'
THEN
MESSAGE ('Enter Financial Year in YYYY-MM Format');
MESSAGE('Enter Financial Year in YYYY-MM Format');
RAISE FORM_TRIGGER_FAILURE;
END IF;
but if i combine both conditions i.e
IF LENGTH(:GENERATE.FIN_YEAR)<>7
and SUBSTR(:GENERATE.FIN_YEAR,5,1)<>'-'
THEN
MESSAGE ('Enter Financial Year in YYYY-MM Format');
MESSAGE('Enter Financial Year in YYYY-MM Format');
RAISE FORM_TRIGGER_FAILURE;
END IF;
it just validates length and bypasses 2nd condition. that is why i wanted to use format masking.