Skip to Main Content

SQL & PL/SQL

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!

Comparing date to sysdate

600830Apr 15 2010 — edited Apr 15 2010
I'm trying to compare a date from an Oracle database (10g R1) to sysdate but is not working.

DECLARE
   v_exit_date DATE;   --Let's assume exit_date from the database is today's date '15-APR-10'
BEGIN
    SELECT 
      exit_date 
    INTO
      v_exit_date
    FROM TABLE_1 WHERE student_id = 3020;
      
   IF v_exit_date = sysdate  THEN
       dbms_output.putline ('Dates are equal');
   ELSE
       dbms_output.putline ('Dates are not equal');
   END;
END;
The equal (=) expression is not evaluated. I'm always getting "Dates are not equal" when expecting "Dates are equal". What's wrong with my PL/SQL?

Thanks

Edited by: Northstar on Apr 15, 2010 11:32 AM
This post has been answered by fsitja on Apr 15 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2010
Added on Apr 15 2010
4 comments
36,968 views