DECLARE 
V_APP NUMBER;

BEGIN
   BEGIN
      SELECT COUNT(1) 
        INTO V_APP
        FROM APP_APLICATIVO
      WHERE NMAPLICATIVO = 'MYMENU';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
            V_APP := 0;
   END;
   IF V_APP = 0 THEN
      INSERT INTO APP_APLICATIVO(NRAPLICATIVO, NMAPLICATIVO) VALUES (1, 'MYMENU'); 
	END IF;
   
   BEGIN
      SELECT COUNT(1) 
        INTO V_APP
        FROM APP_APLICATIVO
      WHERE NMAPLICATIVO = 'MYQUEST';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
            V_APP := 0;
   END;
   IF V_APP = 0 THEN
      INSERT INTO APP_APLICATIVO(NRAPLICATIVO, NMAPLICATIVO) VALUES (2, 'MYQUEST'); 
	END IF;
   
   BEGIN
      SELECT COUNT(1) 
        INTO V_APP
        FROM APP_APLICATIVO
      WHERE NMAPLICATIVO = 'MYORDER';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
            V_APP := 0;
   END;
   IF V_APP = 0 THEN
      INSERT INTO APP_APLICATIVO(NRAPLICATIVO, NMAPLICATIVO) VALUES (3, 'MYORDER'); 
	END IF;

   BEGIN
      SELECT COUNT(1) 
        INTO V_APP
        FROM APP_APLICATIVO
      WHERE NMAPLICATIVO = 'QUESTION';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
            V_APP := 0;
   END;
   IF V_APP = 0 THEN
      INSERT INTO APP_APLICATIVO(NRAPLICATIVO, NMAPLICATIVO) VALUES (4, 'QUESTION');
   END IF;
   
   BEGIN
      SELECT COUNT(1) 
        INTO V_APP
        FROM APP_APLICATIVO
      WHERE NMAPLICATIVO = 'APPROVE';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
            V_APP := 0;
   END;
   IF V_APP = 0 THEN
      INSERT INTO APP_APLICATIVO(NRAPLICATIVO, NMAPLICATIVO) VALUES (5, 'APPROVE');
   END IF;
   
END;