How to insert a timestamp in Oracle?

Blog-39.jpg

In this blog, we will learn how to insert a timestamp in SQL. Oracle is a database software that uses the Relational database management concept, which means we can store the data in the form of tables.

Table of contents:

How to insert a timestamp in Oracle?

To insert a timestamp in Oracle, we have to follow the syntax below:

Syntax:

INSERT INTO table_name (timestamp_column) 
VALUES (CURRENT_TIMESTAMP);

Where,

  • CURRENT_TIMESTAMP  is the current date and time
  • table_name is the name of the table.
  • Timestamp_column  is the column name

Example to insert a timestamp in Oracle?

Let’s learn this concept with the below example, suppose we create a table named Employee, and we want to insert the hiring date of the employee.

Create a table

CREATE TABLE employee (
    employee_id INT,
    hire_date TIMESTAMP
);

Insert data into the table

INSERT INTO employee (employee_id, hire_date) 
VALUES (1, SYSTIMESTAMP);

INSERT INTO employee (employee_id, hire_date) 
VALUES (2, TIMESTAMP '2024-11-15 10:30:00');

Printing the table

SELECT * FROM employee;

Output:

employee_id hire_date
123-JAN-25 01.26.03.918690 PM
215-NOV-24 10.30.00.000000 AM

Conclusion

So far in this article, we have learned how we can insert a timestamp in Oracle with an example. If you want to excel in your career in SQL, you should visit our SQL course. If you want to excel in your career in SQL, you may refer to our SQL Course

About the Author

Technical Content Writer | Software Developer

Nirnayika Rai is a Software Engineer and Technical Content Writer with experience in full-stack development, cloud platforms, and software systems. She creates clear, well-structured content that helps developers understand and apply technical concepts with confidence. Her work combines coding knowledge with a strong focus on clarity, accuracy, and practical relevance.

Intellipaat