advantage of using a trigger to populate surrogate key in oracle plsql

后端 未结 2 1180
无人及你
无人及你 2021-01-22 18:55

I am working on a codebase which has the following type of pattern for generating surrogate key for tables.

create or replace
TRIGGER TEST_TRIG
BEFORE INSERT  OR         


        
2条回答
  •  广开言路
    2021-01-22 19:30

    Trigger and insert statement both have different functionalists if you want just to insert the data and put no logs for that insertion than this insert Statement would be fine but that you can be sure of integrity of the data in table as it can be modified by a number of sources on the other hand if you want logs for every insert/update statement fired on the table irrespective of the call in your block triggers would be helpful and data integrity can be given a check at any point of time.

提交回复
热议问题