Reputation: 675
i have a table in apex oracle, i have a goal, constantly see the current date and time in the table after updating it. Someone can tell you how to do it. For example:
Current date
10.10.2019 16:20:39
And after updating this table:
Current date
10.10.2019 16:21:39
Upvotes: 1
Views: 394
Reputation: 181
You can use triggers to achieve what you wanted. triggers are queries which fire on any CRUD actions.
So according to your scenario you need to create a trigger to update the current date and time column when updating your table row.
Hope this might help you http://www.mysqltutorial.org/mysql-triggers.aspx
Upvotes: 2
Reputation: 65105
You can use this syntax :
ALTER TABLE tab MODIFY current_date DEFAULT SYSDATE
provided your table already has current_date
column of date type,
Use ALTER TABLE tab ADD current_date DATE DEFAULT SYSDATE
if it's a non-existing column yet.
Upvotes: 3