简体   繁体   中英

Check if date is greater than/less than

to_char(to_date(A.PERMISSION_USE_DT, 'YYYY-MM-DD')) < to_char(to_date(sysdate, 'YYYY-MM-DD'))

A.PERMISSION_USE_DT is currently formatted as 04/12/2013 ; I would like to check and match if the date is older than the system date. How do I do this?

If A.Permission_Use_Dt is a date type, there's no need to do the TO_CHAR/TO_DATE conversions. Just do this:

A.Permission_Use_Dt < SYSDATE

Note that SYSDATE also has a time component, so it's today's date and time right now . To compare just the date part of the values, do this:

TRUNC(A.Permission_Use_Dt) < TRUNC(SYSDATE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM