When using to_char you are comparing strings.

Copyto_char(date '2000-01-20', 'DD-MM-YYYY') > to_char(date '2018-05-14', 'DD-MM-YYYY')

because '20-01-2000' is greater than '14-05-2018', because of the first letters in the strings: '2' > '1'.

And CURRENT_DATE is hardly ever used, because it uses your computer's time, rather than the database time, so you can easily be some hours off. Use SYSDATE instead.

Answer from Thorsten Kettner on Stack Overflow
🌐
W3Resource
w3resource.com › oracle › datetime-functions › oracle-current_date-function.php
Oracle CURRENT_DATE function - w3resource
September 2, 2024 - Oracle CURRENT_DATE function : CURRENT_DATE returns the current date in the session time zone, in a value in the Gregorian calendar of datatype DATE. This tutorial explains how to use the CURRENT_DATE function with syntax, parameters, examples ...
🌐
Oracle
docs.oracle.com › en › database › oracle › oracle-database › 19 › sqlrf › CURRENT_DATE.html
CURRENT_DATE
November 12, 2025 - CURRENT_DATE returns the current date in the session time zone, in a value in the Gregorian calendar of data type DATE.
🌐
LearnSQL.com
learnsql.com › cookbook › how-to-get-the-current-date-in-oracle
How to Get the Current Date in Oracle | LearnSQL.com
SELECT TO_CHAR(CURRENT_DATE, 'yyyy-MM-dd') AS current_date FROM dual; For example, If you were to run this query on June 16, 2021, the result table would look like this: To get a text of VARCHAR2 type that stores a date, you can use the TO_CHAR() ...
🌐
Oracle
docs.oracle.com › cd › B19306_01 › server.102 › b14200 › functions172.htm
SYSDATE
May 12, 2008 - SYSDATE returns the current date and time set for the operating system on which the database resides. The datatype of the returned value is DATE, and the format returned depends on the value of the NLS_DATE_FORMAT initialization parameter. The function requires no arguments.
🌐
Database Heartbeat
database-heartbeat.com › 2021 › 09 › 28 › sysdate-vs-current_date-in-oracle-database
SYSDATE vs. CURRENT_DATE in Oracle Database – Database Heartbeat
March 8, 2023 - CURRENT_DATE returns the current date in the session time zone. The same story applies to SYSTIMESTAMP and CURRENT_TIMESTAMP. When database and application servers are set to the same time zone, both functions will return the…
🌐
Oracle Tutorial
oracletutorial.com › home › oracle date functions › oracle current_date
Oracle CURRENT_DATE Function
May 12, 2025 - The CURRENT_DATE function returns the current date and time in the session time zone.
🌐
Oracle Tutorial
oracletutorial.com › home › oracle date functions › oracle sysdate function
Oracle SYSDATE
May 12, 2025 - Use the Oracle SYSDATE function to get the current system date and time.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 69707693 › how-can-i-add-the-current-date-in-oracle-sql-column
How can I add the current date in ORACLE SQL column? - Stack Overflow
PERIOD FOR statement is used for temporal tables. some_date is just a past date, that I'll set. 2021-10-25T12:08:47.96Z+00:00 ... Let's say I have the record: Name: a Salary: 123 StartDate: 10-10-2020 EndDate: now and then I want to update the salary such that I'll have 2 record for the same person: Name: a Salary: 123 StartDate: 10-10-2020 EndDate: 25-10-2021; Name: a Salary: 123 StartDate: 25-10-2021 EndDate: now 2021-10-25T12:14:46.457Z+00:00 ... Aha. It is about temporal validity (oracle-base.com/articles/12c/…).
🌐
YouTube
youtube.com › database star
Oracle CURRENT_DATE Function - YouTube
https://www.databasestar.com/oracle-date-functions/ The Oracle CURRENT_DATE function is used to return the current date in the session timezone. The session ...
Published   March 8, 2018
Views   1K
Top answer
1 of 3
24

To select current date (Today) before midnight (one second before) you can use any of the following statements:

SELECT TRUNC(SYSDATE + 1) - 1/(24*60*60) FROM DUAL
SELECT TRUNC(SYSDATE + 1) - INTERVAL '1' SECOND FROM DUAL;

What it does:

  1. Sum one day to SYSDATE: SYSDATE + 1, now the date is Tomorrow
  2. Remove time part of the date with TRUNC, now the date is Tomorrow at 00:00
  3. Subtract one second from the date: - 1/(24*60*60) or - INTERVAL '1' SECOND FROM DUAL, now the date is Today at 11:59:59

Note 1: If you want to check date intervals you might want to check @Allan answer below.

Note 2: As an alternative you can use this other one (which is easier to read):

SELECT TRUNC(SYSDATE) + INTERVAL '23:59:59'  HOUR TO SECOND FROM DUAL;
  1. Remove time part of the current date with TRUNC, now the date is Today at 00:00
  2. Add a time interval of 23:59:59, now the date is Today at 11:59:59

Note 3: To check the results you might want to add format:

SELECT TO_CHAR(TRUNC(SYSDATE + 1) - 1/(24*60*60),'yyyy/mm/dd hh24:mi:ss') FROM DUAL
SELECT TO_CHAR(TRUNC(SYSDATE + 1) - INTERVAL '1' SECOND,'yyyy/mm/dd hh24:mi:ss') FROM DUAL
SELECT TO_CHAR(TRUNC(SYSDATE) + INTERVAL '23:59:59','yyyy/mm/dd hh24:mi:ss') FROM DUAL
2 of 3
12

Personally, I dislike using one second before midnight. Among other things, if you're using a timestamp, there's a possibility that the value you're comparing to falls between the gaps (i.e. 23:59:59.1). Since this kind of logic is typically used as a boundary for a range condition, I'd suggest using "less than midnight", rather than "less than or equal to one second before midnight" if at all possible. The syntax for this simplifies as well. For instance, to get a time range that represents "today", you could use either of the following:

date_value >= trunc(sysdate) and date_value < trunc(sysdate) + 1
date_value >= trunc(sysdate) and date_value < trunc(sysdate) + interval '1' day

It's a little more cumbersome than using between, but it ensures that you never have a value that falls outside of the range you're considering.

🌐
O'Reilly
oreilly.com › library › view › oracle-pl-sql-programming › 9780596805401 › ch10s02.html
Getting the Current Date and Time - Oracle PL/SQL Programming, 5th Edition [Book]
September 24, 2009 - In any language, it’s important to know how to get the current date and time. How to do that is often one of the first questions to come up, especially in applications that involve dates in any way, as most applications do. Up through Oracle8i Database, you had one choice for getting the date and time in PL/SQL: you used the SYSDATE function, and that was it.
Authors   Steven FeuersteinBill Pribyl
Published   2009
Pages   1226
🌐
W3Resource
w3resource.com › oracle › datetime-functions › oracle-current_timestamp-function.php
Oracle CURRENT_TIMESTAMP function - w3resource
Oracle CURRENT_TIMESTAMP function : The CURRENT_TIMESTAMP() function returns the current date and time in the session time zone, in a value of datatype TIMESTAMP WITH TIME ZONE. This tutorial explains how to use the CURRENT_TIMESTAMP function ...
🌐
W3Resource
w3resource.com › oracle › datetime-functions › oracle-sysdate-function.php
Oracle SYSDATE function - w3resource
September 21, 2024 - Oracle SYSDATEC function: SYSDATE returns the current date and time. This tutorial explains how to use the SYSDATE function with syntax, parameters, examples and explanation.
🌐
TechOnTheNet
techonthenet.com › oracle › functions › sysdate.php
Oracle / PLSQL: SYSDATE function
November 12, 2025 - The Oracle/PLSQL SYSDATE function returns the current system date and time on your local database.
🌐
TechOnTheNet
techonthenet.com › oracle › functions › current_date.php
Oracle / PLSQL: CURRENT_DATE function
September 10, 2005 - This Oracle tutorial explains how to use the Oracle / PLSQL CURRENT_DATE function with syntax and examples. The Oracle / PLSQL CURRENT_DATE function returns the current date in the time zone of the current SQL session as set by the ALTER SESSION command.