Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in SQL by (6.1k points)
I am having an Oracle database with a timestamp type field in it. I want to insert the timestamp data into that field. What will be the right SQL code(syntax) for inserting a timestamp into this field?

1 Answer

0 votes
by (12.7k points)
edited by

You can use the below code:

insert
into tablename (timestamp_value)
values (TO_TIMESTAMP(:ts_val, 'YYYY-MM-DD HH24:MI:SS'));

If you need the current timestamp to be inserted then use the following code: 

insert
into tablename (timestamp_value)
values (CURRENT_TIMESTAMP);

Willing to Learn SQL? Sign up for the SQL Certification course by Intellipaat.

Watch the below SQL video tutorial to gain more knowledge on SQL...

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...