Prevent Insert Trigger

前端 未结 2 1287
隐瞒了意图╮
隐瞒了意图╮ 2021-01-12 09:42

How can I get this trigger to prevent the insert where the advance is not greater than 0 or less than 100? Thanks.

DROP TRIGGER CheckAdvance;
CREATE OR REPLA         


        
2条回答
  •  有刺的猬
    2021-01-12 10:31

    You shouldn't use a trigger for this. Oracle (and SQL in general) supports check constraints:

    alter table titles
        add constraint chk_titles_advance check (advance > 0 and advance <= 100);
    

提交回复
热议问题