/*
@c:\web_405\sql\end_conv\oracle\4010_ESTTRGO_Atualiza_LocalAlmox.SQL
*/

CREATE OR REPLACE TRIGGER ATUALIZA_LOCALALMOX
AFTER INSERT
ON ALMOXARIFADO FOR EACH ROW

BEGIN
   IF INSERTING THEN
      INSERT INTO LOCALESTOQUE
      (CDFILIAL, CDALMOXARIFE, CDLOCALESTOQ, DSLOCALESTOQ)
      (SELECT :NEW.CDFILIAL, :NEW.CDALMOXARIFE , ' ', ' '
       FROM PARAMGERAL
       MINUS
       SELECT CDFILIAL, CDALMOXARIFE, CDLOCALESTOQ, ' '
       FROM LOCALESTOQUE
       WHERE
          CDFILIAL     = :NEW.CDFILIAL       AND
          CDALMOXARIFE = :NEW.CDALMOXARIFE   AND
          CDLOCALESTOQ = ' ');      
   END IF;
END;
/

-- VERSAO --
BEGIN ATUVEROBJ('ATUALIZA_LOCALALMOX','4.11.013'); END;
/

