SET SERVEROUTPUT ON
SET ECHO ON;
SET FEEDBACK 1;
col object_name format a30;

select object_name, object_type, status from user_objects where status ='INVALID';


DECLARE
CURSOR objetos_usuario IS
SELECT object_type, object_name
FROM USER_OBJECTS
WHERE STATUS = 'INVALID'
AND object_type IN ('PROCEDURE','FUNCTION','PACKAGE','PACKAGE BODY','VIEW');

BEGIN

	 FOR OBJETOS_REC IN OBJETOS_USUARIO LOOP
	 	 DBMS_DDL.ALTER_COMPILE( OBJETOS_REC.OBJECT_TYPE,'Q02B' ,OBJETOS_REC.OBJECT_NAME );
	 END LOOP;
	 
END;
/

select object_name, object_type, status from user_objects where status ='INVALID';

