SQL row modification constraint
-
09-10-2019 - |
Pergunta
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!
Solução
Check the documentation...
CREATE TRIGGER No_Updates_To_Table_X
BEFORE UPDATE ON Table_X
....
Or with permissions:
REVOKE UPDATE ON XXXX FROM YYYY ....
Outras dicas
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.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow