CREATE OR REPLACE PROCEDURE sp_fdt_del_bancos_proc
(
  psi_id_rep  smallint,
  pvc_usuario varchar2,
  pti_banco   number
)
AS
/********************************************************************/
/*** Módulo Fiscal de Colombia                                    ***/
/*** Descripcion: borra registros de las tablas usadas en bancos  ***/
/*** Autor:	Diana Cecilia Rios Peinado                            ***/
/*** Fecha:	Abril 27 de 2005                                      ***/
/********************************************************************/

BEGIN

     DELETE FROM ri_procesar 
     WHERE id_rep = psi_id_rep AND usuariow = pvc_usuario;

     DELETE FROM ri_liq_procesar 
     WHERE id_rep = psi_id_rep AND usuariow = pvc_usuario;     

     DELETE FROM fdt_bancos_mm
     WHERE id_rep = psi_id_rep AND usuariow = pvc_usuario
     AND banco = pti_banco;

     DELETE FROM fdt_bancos_resultados 
     WHERE id_rep = psi_id_rep AND usuariow = pvc_usuario
     AND banco = pti_banco;

     DELETE FROM fdt_bancos_rep
     WHERE id_rep = psi_id_rep AND usuariow = pvc_usuario
     AND banco = pti_banco;

    DELETE FROM fdt_bancos_tmp
    WHERE id_rep = psi_id_rep AND usuariow = pvc_usuario;
    
    DELETE FROM fdt_bancos_err
    WHERE id_rep = psi_id_rep AND usuariow = pvc_usuario;
    
    COMMIT WORK;

END;
/
CREATE PUBLIC SYNONYM sp_fdt_del_bancos_proc FOR ADAM.sp_fdt_del_bancos_proc;
GRANT EXECUTE ON sp_fdt_del_bancos_proc TO adama;
