开发者

SQL row modification constraint

I have a table, containing log entries. Is it possible to impose on it a constraint, restricting all modifications of rows, but still allowing addition and deletion of rows? For example if I have:

开发者_运维知识库ID| Time |     Issue      | Result
------------------------------------
3   10:30  heating broke    repaired

It should be impossible to change id, time, issue or result, but it should be possible to create new rows or to delete the row.

I am using Oracle.

Many thanks!


Check the documentation...

CREATE TRIGGER No_Updates_To_Table_X
BEFORE UPDATE ON Table_X
....

Or with permissions:

REVOKE UPDATE ON XXXX FROM YYYY ....


Though it's not good to assume, I'm going to on this; Oracle should allow you to create a user account with DELETE and CREATE permissions, but disallow UPDATE/ALTER. I would start with user-level permissions and go from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜