Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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