1
Trigger that prevents a candidate who has stayed in the penultimate place during the last two months to apply for a new job
so what I need to do is before entering the data into the table ficha_inscricao verify that this candidate was not the one who had the second worst classificacao_final.nota_final
CREATE OR REPLACE TRIGGER impede_candidato
BEFORE INSERT ON ficha_inscricao
WHEN (:new.candidatoBI = candidato.BI and
      candidato.bi=classificacao_final.candidatoBI and 
      classificacao_final.nota_final ............)
DECLARE impedido EXCEPTION;
BEGIN 
  RAISE impedido;
  EXCEPTION 
    WHEN impedido THEN RAISE_APPLICATION_ERROR (-20001, 'Não se pode inscrever');
END;
I tried to do with  order by DESC plus rownum=2 but I couldn’t get past the syntax errors.

where does it fit with Trigger and prevent the table
ficha_inscricaobe updated?– Daniela Maia
So, I never worked with triggers so I had only suggested the query of select, but studying a little I think I was able to assemble it. Test it and see if it works.
– Rodrigo Rigotti