user1159937
user1159937

Reputation: 33

SQL query in Oracle to remove the time or set it to default 00:00:00 without impacting the date

How to remove the time from the datetime column in oracle database and save it back with the default time as 00:00:00 without impacting the any date.

for ex: I have a column data type datetime and have thousands of record including date and time as well. I want to keep all the dates as it is and set the time to default as 00:00:00 or remove it completely from all the records in this column. please let me know any query to do so ?

Upvotes: 3

Views: 1221

Answers (1)

Cade Roux
Cade Roux

Reputation: 89661

UPDATE tbl
SET dtcol = TRUNC(dtcol)

http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions201.htm

Upvotes: 7

Related Questions