Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Validate a year

768419Mar 7 2011 — edited Mar 7 2011
Hi,
I'm using forms6i.
I have a text field in my form to enter Year. How can i programmatically check whether the year is valid or not?
I'm doing like this right now
Declare
	 Format_Error EXCEPTION;
	 PRAGMA EXCEPTION_INIT(Format_Error, -01830);
	 
	 conv_year Date;
Begin
	 	If 	:PYEAR is null then
			Msg_Alert('Enter a Year!','I',FALSE);
		Else
			 	conv_year := to_date(:PYEAR , 'YYYY');
		 	
		End if;

Exception 
	When Format_Error then
	Msg_alert('Enter a Valid Year !','E',TRUE);
	When Others then
	Msg_Alert('Exception '||sqlerrm,'E',TRUE);
End;
Is this the right way to check for a valid year?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 4 2011
Added on Mar 7 2011
3 comments
365 views