CREATE OR REPLACE PROCEDURE BUSCA_TPCOMERCIAL(P_CDCONTCTBL IN VARCHAR2,
                                              P_IDCOME     OUT VARCHAR2,
                                              P_IDCCUS     OUT VARCHAR2)
AS
   V_IDCODCOME VARCHAR2(01);
   V_IDCCUS VARCHAR2(21);
BEGIN

   BEGIN
      SELECT NVL(IDTIPOCOME, 'N') IDTIPOCOME, IDCONTCCUS
        INTO V_IDCODCOME, V_IDCCUS
        FROM CONTCTBL
       WHERE CDCONTCTBL = P_CDCONTCTBL;
   EXCEPTION
      WHEN NO_DATA_FOUND THEN
         V_IDCODCOME  := 'N';
         V_IDCCUS := 'L';
   END;

   P_IDCOME := V_IDCODCOME;
   P_IDCCUS := V_IDCCUS;
END;

/

-- VERSAO --
BEGIN ATUVEROBJ('BUSCA_TPCOMERCIAL','5.60.000'); END;
/
