title: 'Bad bind variable' in a trigger
body: <p>I have a problem with my code written with SQL Developer relative to the following trigger:</p>
  
  <pre><code>CREATE OR REPLACE TRIGGER AGGIORNA_QTA 
  AFTER INSERT ON ACQUISTI 
  FOR EACH ROW 
  BEGIN
    update prodotti set qta=:old.qta-(select qtaacq from acquisti
      where utente=:new.utente and prodotto=:new.prodotto and data=:new.data);
  END;
  </code></pre>
  
  <p>This is the database table definition:</p>
  
  <pre><code>CREATE TABLE PRODOTTI(  
   CODICE NUMBER, 
   NOME VARCHAR2(10), 
   QTA NUMBER, 
   PREZZO NUMBER, 
   PRIMARY KEY ("CODICE"))
  
  CREATE TABLE UTENTI(
   USERNAME VARCHAR2(10), 
   NOME VARCHAR2(10), 
   COGNOME VARCHAR2(10), 
   PRIMARY KEY ("USERNAME"))
  
  CREATE TABLE ACQUISTI(
   UTENTE VARCHAR2(10), 
   PRODOTTO NUMBER, 
   DATA DATE, 
   QTAACQ NUMBER, 
   PRIMARY KEY (UTENTE,PRODOTTO,DATA),
   FOREIGN KEY (UTENTE) REFERENCES UTENTI (USERNAME),
   FOREIGN KEY (PRODOTTO) REFERENCES PRODOTTI (CODICE)) 
  </code></pre>
  
  <p>The problem is that I keep getting the following error:</p>
  
  <pre><code>Error(2,29): PLS-00049: bad bind variable 'OLD.QTA'
  </code></pre>
  
  <p>What am I doing wrong?</p>