CREATE OR REPLACE PROCEDURE FCT_EXCLUIR_PARCELAS_FATURA (
    P_NRSEQCONTRATO IN FCT_CONTRATO.NRSEQCONTRATO%TYPE,
    P_NRORG         IN NUMBER
)
AS
BEGIN

    DELETE FROM FCT_FATURACONT
     WHERE NRSEQCONTRATO   = P_NRSEQCONTRATO
       AND NRORG           = P_NRORG
       AND NRAPURACAO      IS NULL
       AND NRMEDICAOFATURA IS NULL;

    DELETE FROM FCT_MEDICAOFATURA
     WHERE NRSEQCONTRATO = P_NRSEQCONTRATO
       AND NRORG         = P_NRORG
       AND IDSITUACAO    = '1';

END;