I'm learning ORACLE and I create a trigger that after each insertion in the Commission table is added in the Pago_Com column from the table UEA em> which in turn is related to the table Guia_Transito and when I try to insert in the table Commission this message jumps me:
single-row subquery returns more than one row
This is my trigger:
create or replace trigger ocex_comi_total
after insert or update of id_gt on ocex_comi
begin
update ocex_comi cm set
cm.PAGO_COM= (select uea.total from OCEX_GT_PER GTP
join OCEX_PER P ON GTP.ID=P.ID_PER
join OCEX_GUIA_TRANSITO GT ON GTP.ID_GT=GT.COD_GT
join OCEX_UEA UEA ON GT.DEST_ENTREG=UEA.N_MINA)
where cm.ID_GT = (select gtp.id_gt from OCEX_GT_PER gtp);
end;
Any guidance to let me insert and upload the data? Thanks.