CREATE OR REPLACE PROCEDURE REGISTRA_LOG_REPLICACARDPLA
( 
	P_DTCARDORI IN DATE,
	P_CDFILIAL IN VARCHAR2,
	P_CDSERVFILI IN VARCHAR2,
	P_DTCARDDEST IN DATE,
	P_IDERRO IN VARCHAR2,
	P_CDOPERADOR IN VARCHAR2,	
	P_NRORG IN NUMBER
)
AS	
   V_NRLOGREPLICACARDPLA NUMBER;
   PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
	V_NRLOGREPLICACARDPLA := TO_NUMBER(RETORNA_NOVO_CODIGO('LOGREPLICACARDPLA', 1));
   INSERT INTO LOGREPLICACARDPLA
   (
   NRLOGREPLICACARDPLA, DTREPLICACAO, CDFILIAL, CDSERVFILI, 
   DTMESORIGEM, DTMESDEST, IDERRO, 
   NRORG, NRORGINCLUSAO, NRORGULTATU, 
   DTINCLUSAO, DTULTATU, 
   CDOPERINCLUSAO, CDOPERULTATU
   )
   VALUES
   (
   V_NRLOGREPLICACARDPLA, TRUNC(SYSDATE), P_CDFILIAL, P_CDSERVFILI,
   P_DTCARDORI, P_DTCARDDEST, P_IDERRO, 
   P_NRORG, P_NRORG, P_NRORG, 
   SYSDATE, SYSDATE, 
   P_CDOPERADOR, P_CDOPERADOR
   );

   COMMIT;
END;
/