Examples for validating dates in pl sql

The following table lists the fields and their possible values for datetimes and intervals.

Following are the Datetime data types − It stores date and time information in both character and number datatypes.

If I wanted to know how many months an employee has worked for the company, I can use this Oracle date function. Notice that this Oracle date function returns the fraction of a month. to be no larger than 12 (for the month) and the second ?? If all pass, then to assembly a date-typed value by using the "add_months()" function to build the year and month, and using the " " function to build the date.This example assumes the date format to be "MM-DD-YYYY". but I don't recommend you rely on this implicit conversiosn. For more on this topic, you could read this: In your case, if you want to format your DATE to log something, or to show in your UI or wathever in a different format, you need to assig it to a varchar variable as Justin said, something like this: ....v_generated_run_date DATE; v_var_date VARCHAR2(30); BEGIN -- generate sysdate if required IF (i_Run Date is null) THEN v_var_date:=TO_CHAR(sysdate, 'MM/DD/YYYY HH12: MI: SS AM'); ELSE v_var_date:=TO_CHAR(i_Run Date,'MM/DD/YYYY HH12: MI: SS AM'); END IF; pkgschedule.createschedule (v_var_date); commit; END runschedule; END Can you post some code to show me how you're using it?

Leave a Reply