oracle - 'Bad bind variable' in a trigger -
I have a problem with the code written with the SQL developer related to the following code:
< Code> Create or change the trigger AGGIORNA_QTA after entry on ACQUISTI for each route, replace qtd = = old.qta- (select qtaacq where utente =: new.utente and prodotto =: new.prodotto and data =: New.data); End;
This is the definition of the database table:
create table prodotti (code number, noam vARCHAR2 (10), qta number, prezo number, primary key ( "Code") Create tabs utility (USERNAME VARCHAR2 (10), NOM VARCHAR2 (10), CONNON VARCHAR2 (10), Primary key ("USERNAME")) Tabul AQUIVITY (UTNT VARCHAR2 (10), PRODOTO NUMBER, Date of Data , QTAACQ NUMBER, primary key (uttepe, promo, data), foreign key reference user (user), foreigner The problem is that I keep getting the following error: error (2,29): PLS-200049 : Bad bind variable 'old.qt'
What is I doing wrong?
You are not specifying the row to the table which is either to be updated, so you can add something like this Required: But then you are trying to select from the table in which you agree So that you will get an ORA-04091 mutating table error. As you are inquiring based on the primary key, you can not expect more than one line, so you do not have to query at all, you can just type the . You can see that this master does not retain the volume in the table because you expect it in a multiuser environment. Together the inserts can see the same old old and new Against the table for present. You can reference directly the qta of the table you are updating, and it will use the current value for calculation:
update Prodotti set qta = qta - ...
where codice =: New.prodotto qtaacq value of the new line You can use after entering on ACQUISTI for each root, to create or change trigger AGGIORNA_QTA, update qta = qta - new.qtaacq where codice =: new.prodotto; End; / qta value and move the lost updates forward.
Comments
Post a Comment