Home Privacy Policy Feedback Link to us Site Map Forums

Oracle/PLSQL: Sysdate function


In Oracle/PLSQL, the sysdate function returns the current system date and time on your local database.

The syntax for the sysdate function is:

sysdate


Applies To:

  • Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g

Example #1:

select sysdate
into v_date
from dual;

The variable called v_date will now contain the current date and time value.


Example #2

You could also use the sysdate function in any SQL statement. For example:

select supplier_id, sysdate
from suppliers
where supplier_id > 5000;


Example #3

If you wanted to extract the date portion only (and exclude the time component), you could use the to_char function. For example:

select supplier_id, to_char(sysdate, 'yyyy/mm/dd')
from suppliers
where supplier_id > 5000;