Salve ragazzi, la tabella è la seguente :
ANAGRAFICA(codiceFiscale, nome, cognome, salario, capoUfficio: ANAGRAFICA)
E queste sono le condizioni del trigger :
Impostare l’intestazione ed il corpo di un trigger che all'atto della modifica di un salario di undipendente, aggiorna automaticamente il salario del relativo capoufficio della stessa quantità.
Ho avuto un po di difficoltà nel risolverlo, avevo pensato a una soluzione del genere :
Il trigger viene compilato correttamente, ma quando effettuo una operazione di update mi esce questo errore :codice:create or replace trigger trigg30 after update on Anagrafica for each row begin update Anagrafica set Salario = :new.Salario where codiceFiscale = :old.Capoufficio ; end;
[CODE] Errore SQL: ORA-04091: table SYSTEM.ANAGRAFICA is mutating, trigger/function may not see it
ORA-06512: at "SYSTEM.TRIGG30", line 2
ORA-04088: error during execution of trigger 'SYSTEM.TRIGG30'
04091. 00000 - "table %s.%s is mutating, trigger/function may not see it"
*Cause: A trigger (or a user defined plsql function that is referenced in
this statement) attempted to look at (or modify) a table that was
in the middle of being modified by the statement which fired it.
*Action: Rewrite the trigger (or function) so it does not read that table. [CODE]
Qualcuno avrebbe qualche suggerimento da darmi in merito? Grazie in anticipo a chiunque risponderà