Recompile all invalid package : user_objects « System Tables Data Dictionary « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> declare
  2      cursor myCursor is select object_type, object_name from SYS.USER_OBJECTS where  status = 'INVALID'
  3      order by 1, 2;
  4      sqlString varchar2(100);
  5  begin
  6    for r1 in myCursor loop
  7      begin
  8        if r1.object_type = 'PACKAGE BODY' then
  9
 10          sqlString := 'alter PACKAGE '||r1.object_name||' compile BODY';
 11
 12        elsif r1.object_type = 'TYPE BODY' then
 13
 14          sqlString := 'alter TYPE '||r1.object_name||' compile BODY';
 15
 16        else
 17
 18          sqlString := 'alter '||r1.object_type||' '||r1.object_name||' compile';
 19
 20        end if;
 21
 22        execute immediate sqlString;
 23
 24        dbms_output.put_line(r1.object_type||' '||r1.object_name||' compiled successfully');
 25
 26      exception
 27
 28        when OTHERS then
 29
 30          dbms_output.put_line(SQLERRM||' on '||sqlString);
 31
 32      end;
 33
 34    end loop;
 35
 36  end;
 37  /

PL/SQL procedure successfully completed.

SQL>








30.90.user_objects
30.90.1.Check user_objects for object name
30.90.2.Check the package status in user_objects
30.90.3.Check function/procedure status
30.90.4.Check the status for all stored procedures is by using the Oracle data dictionary view USER_OBJECTS
30.90.5.Get invalid table objects by joining user_segments and user_objects
30.90.6.Get all invalid user objects in user_objects table
30.90.7.Create drop command by query the user_objects table
30.90.8.Create grant permission command by querying user_objects table
30.90.9.Query user_objects for all packages, procedures and functions
30.90.10.Query user_objects for user-defined data type
30.90.11.Recompile all invalid package
30.90.12.Query user_objects for all java classes
30.90.13.Query user_objects for all PL/SQL code
30.90.14.Get Object id from user_objects
30.90.15.Join sys.col$ and user_objects
30.90.16.Query user_objects for object status
30.90.17.Query user_objects for your functions and procedures
30.90.18.User and its average object id
30.90.19.Show the procedure is marked invalid **
30.90.20.Behavior of dependent objects.
30.90.21.Finding, Validating, and Describing Packages
30.90.22.If procedure is valid