Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR when using getDate() in oracle to update rows

I have a table with a column called STREAM_TIME of DATE type.
I'm trying to update all rows for that column to today's date. The database used is oracle.

My query:

update bns_bess_messages SET stream_time=getDate();

Oracle comes back with this error:

SQL Error: ORA-00904: "GETDATE": invalid identifier
00904. 00000 -  "%s: invalid identifier"

How can I update STREAM_TIME to today's date?

Thanks

like image 791
Adrian Avatar asked Jul 19 '12 18:07

Adrian


1 Answers

You can do it the following way:

update bns_bess_messages set stream_time = trunc(sysdate);

Or if you want to get the exact time:

update bns_bess_messages set stream_time = sysdate;

To check you can use the following query:

select sysdate from dual;
like image 179
Andrew Logvinov Avatar answered Nov 15 '22 06:11

Andrew Logvinov