Ask the Expert

Check if date is greater than 2000 in PL/SQL

How to check if the date is greater than the year 2000 in PL/SQL?

    Requires Free Membership to View

You have two options here. One option is to convert the date value to a string and do a string comparison as follows:
IF (TO_CHAR(date_val,'YYYY') > '2000') THEN
   
END IF;
Another option is to use the TO_DATE function to convert the comparison string to a date value.
IF (date_val > TO_DATE('12/31/2000','MM/DD/YYYY')) THEN 
   
END IF;

This was first published in April 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: