Share this page:

oracle tutorial

Oracle/PLSQL: SYSDATE function

This Oracle tutorial explains how to use the Oracle/PLSQL SYSDATE function with syntax and examples.

Description

The Oracle/PLSQL SYSDATE function returns the current system date and time on your local database.

Syntax

The syntax for the Oracle/PLSQL SYSDATE function is:

SYSDATE

Parameters or Arguments

There are no parameters or arguments for the SYSDATE function.

Applies To

The SYSDATE function can be used in the following versions of Oracle/PLSQL:

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

Example

Let's look at some Oracle SYSDATE function examples and explore how to use the SYSDATE function in Oracle/PLSQL.

For example:

select SYSDATE
into v_date
from dual;

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

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

select supplier_id, SYSDATE
from suppliers
where supplier_id > 5000;

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;