Coder17
Coder17

Reputation: 873

using update in oracle

I have a column named date_col of data-type date. What's wrong with this query?

update test set date_col = to_date(sysdate,'DD-Mon-YYYY HH24:MI:SS')

Only date mon and yy is visible. not the time.

How can I make it work?

Upvotes: 0

Views: 55

Answers (1)

dani herrera
dani herrera

Reputation: 51655

SYSDATE is yet a date. You don't need to cast SYSDATE to date type because it is a date_

update test 
set date_col = sysdate

To see time fraction use to_char:

select to_char(date_col, 'HH24 MI')
from test;

Upvotes: 2

Related Questions