Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@felclef
Created November 11, 2011 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felclef/1358582 to your computer and use it in GitHub Desktop.
Save felclef/1358582 to your computer and use it in GitHub Desktop.
Compilar todos os objetos no Oracle...
begin
for cur_rec in
(
select
object_name,
object_type
from
user_objects
where
status <> 'VALID'
order by
case
when object_type = 'PACKAGE' then 0
else 1
end
)
loop
begin
if cur_rec.object_type = 'PACKAGE BODY' then
execute immediate 'ALTER PACKAGE "' || cur_rec.object_name || '" COMPILE BODY';
else
execute immediate 'ALTER ' || cur_rec.object_type || '"' || cur_rec.object_name || '" COMPILE';
end if;
exception
when others then
dbms_output.put_line('Não foi possível compilar: ' || cur_rec.object_type || ' : ' || cur_rec.object_name);
dbms_output.put_line(' >>> ' || sqlerrm);
dbms_output.put_line('- - - - -');
end;
end loop;
end;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment