CREATE OR REPLACE 
TRIGGER ATUALIZA_ASSUNTO
BEFORE INSERT OR UPDATE OF CDASSUSOLI
ON SOLISERV FOR EACH ROW
BEGIN
   IF :NEW.CDASSUSOLI = '010' THEN
      :NEW.CDASSUNTO := '00010';
   ELSIF :NEW.CDASSUSOLI = '011' THEN
      :NEW.CDASSUNTO := '00011';
   ELSIF :NEW.CDASSUSOLI = '012' THEN
      :NEW.CDASSUNTO := '00012';
   ELSIF :NEW.CDASSUSOLI = '013' THEN
      :NEW.CDASSUNTO := '00013';
   ELSIF :NEW.CDASSUSOLI = '017' THEN
      :NEW.CDASSUNTO := '00017';
   ELSIF :NEW.CDASSUSOLI IN ('018', '014') THEN
      :NEW.CDASSUNTO := '00018';
   ELSIF :NEW.CDASSUSOLI = '019' THEN
      :NEW.CDASSUNTO := '00060';
   ELSIF :NEW.CDASSUSOLI = '021' THEN
      :NEW.CDASSUNTO := '00021';
   ELSIF :NEW.CDASSUSOLI IN ('032', '063') THEN
      :NEW.CDASSUNTO := '00500';
   ELSIF :NEW.CDASSUSOLI = '030' THEN
      :NEW.CDASSUNTO := '00030';
   ELSIF :NEW.CDASSUSOLI = '031' THEN
      :NEW.CDASSUNTO := '00560';
   ELSIF :NEW.CDASSUSOLI = '041' THEN
      :NEW.CDASSUNTO := '00041';
   ELSIF :NEW.CDASSUSOLI = '051' THEN
      :NEW.CDASSUNTO := '00050';
   ELSIF :NEW.CDASSUSOLI = '052' THEN
      :NEW.CDASSUNTO := '00051';
   ELSIF :NEW.CDASSUSOLI = '053' THEN
      :NEW.CDASSUNTO := '00052';
   ELSIF :NEW.CDASSUSOLI = '054' THEN
      :NEW.CDASSUNTO := '00055';
   ELSIF :NEW.CDASSUSOLI = '055' THEN
      :NEW.CDASSUNTO := '00056';
   ELSIF :NEW.CDASSUSOLI = '056' THEN
      :NEW.CDASSUNTO := '00057';
   ELSIF :NEW.CDASSUSOLI IN ('059', '057') THEN
      :NEW.CDASSUNTO := '00053';
   ELSIF :NEW.CDASSUSOLI = '058' THEN
      :NEW.CDASSUNTO := '00054';
   ELSIF :NEW.CDASSUSOLI = '061' THEN
      :NEW.CDASSUNTO := '01200';
   ELSIF :NEW.CDASSUSOLI = '062' THEN
      :NEW.CDASSUNTO := '01800';
   ELSIF :NEW.CDASSUSOLI = '064' THEN
      :NEW.CDASSUNTO := '00002';
   END IF;
END;
/