PL/SQL TIMESTAMP

The Oracle PL/SQL TIMESTAMP data type is used to store date and time data.

Syntax

The syntax for declaring a variable with the PL/SQL timestamp data type is as follows:

variable_name TIMESTAMP;

For example, you could declare a variable named start_date like this:

declare
start_date TIMESTAMP:=sysdate;
begin
DBMS_OUTPUT.PUT_LINE('start_date = '||start_date);
end;

You can also use the timestamp data type in a table column. The syntax for doing this is as follows:

column_name TIMESTAMP;

For example, you could create a table with a column named start_date like this:

CREATE TABLE test_table ( 
id NUMBER,
comments VARCHAR2(4000),
start_date TIMESTAMP 
);

The PL/SQL timestamp data type is useful for storing date and time data. It has a number of advantages over other data types, such as the ability to store fractional seconds.