what is the best solution: Constraint o database trigger

what is the best solution: Constraint o database trigger

 

  

Hello Great oracle gurus !!!



I a have a question for you, I want to how made the next



A table Salx1 and trax1 the data resume of this tables in a View sal_trx1
(fiel1 - Field2) if this result is not cero, send a user error, I was
created a trigger in Salx1 but when a try to insert oracle say



ERROR at line 1:

ORA-04091: <table schema.table> is mutating, trigger/function may not see it

ORA-06512: at "<table schema.table>", line 4

ORA-04088: error during execution of trigger '<schema.table>',



This error is generated for I am select data of the View sal_trx1 , correct?



A colega say that I made a trigger but not function.



my question is how made a check constraint to compare this to fields in the
view sal_trx1 (fiel1 - Field2)



Can made that?



ALTER TABLE SALx1 ADD(CONSTRAINT SALDO_COMPARA_CK1 CHECK ((select field1
-Field2 from sal_trx1 where ..... )= 0));





What is yours solutions for this problem.





Thanks for yours Help.




Oracle LazyDBA home page