Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to auto update date column without using trigger

Yogesh_NigalJun 28 2012 — edited Jun 28 2012
Hi,

How to write below MYSQL query in Oracle 10g :

CREATE TABLE example_timestamp (
Id number(10) NOT NULL PRIMARY KEY,
Data VARCHAR(100),
Date_time TIMESTAMP DEFAULT current_timestamp on update current_timestamp
);


I need to auto update the Date_Time column without using trigger when ever i update a record.

Example shown below is from MYSQL. I want to perform the below steps in ORACLE to auto update Date_Time column.


mysql> INSERT INTO example_timestamp (data)
VALUES ('The time of creation is:');


mysql> SELECT * FROM example_timestamp;
-------------------------------------------------------------------
| id | data | Date_Time |
-------------------------------------------------------------------
| 1 | The time of creation is: | 2012-06-28 12:37:22 |
--------------------------------------------------------------------


mysql> UPDATE example_timestamp
SET data='The current timestamp is: '
WHERE id=1;

mysql> SELECT * FROM example_timestamp;
-----------------------------------------------------------------------
| id | data | Date_Time |
-----------------------------------------------------------------------
| 1 | The current timestamp is: | 2012-06-28 12:38:55 |
-----------------------------------------------------------------------


Regards,
Yogesh.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2012
Added on Jun 28 2012
6 comments
2,854 views