Oracle / PLSQL: SYSTIMESTAMP function
This Oracle tutorial explains how to use the Oracle/PLSQL SYSTIMESTAMP function with syntax and examples.
Description
The Oracle/PLSQL SYSTIMESTAMP function returns the current system date and time (including fractional seconds and time zone) on your local database.
Syntax
The syntax for the SYSTIMESTAMP function in Oracle/PLSQL is:
SYSTIMESTAMP
Parameters or Arguments
There are no parameters or arguments for the SYSTIMESTAMP function.
Returns
The SYSTIMESTAMP function returns a TIMESTAMP WITH TIME ZONE value.
Applies To
The SYSTIMESTAMP function can be used in the following versions of Oracle/PLSQL:
- Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i
Example
Let's look at some Oracle SYSTIMESTAMP function examples and explore how to use the SYSTIMESTAMP function in Oracle/PLSQL.
For example:
SELECT SYSTIMESTAMP INTO v_time FROM dual;
The variable called v_time will now contain the date and time (including fractional seconds and time zone) at the moment the command is executed.
The SYSTIMESTAMP function might return a value like this:
2015-07-22 10:35:07.417849 -06:00
You can also choose to use the TO_CHAR function with the SYSTIMESTAMP function.
For example:
SELECT TO_CHAR(SYSTIMESTAMP, 'SSSS.FF') FROM dual;
The function above may return a value such as:
4141.550774
You could also use the SYSTIMESTAMP function in any SQL statement.
For example:
SELECT supplier_id, SYSTIMESTAMP FROM suppliers WHERE supplier_id > 5000;
Advertisements