sexta-feira, 29 de abril de 2011

Case com SubSelect

 

select
uo.object_name,
uo.object_type,
case object_type
  when 'TABLE' then (select comments from user_tab_comments tb where tb.table_name = uo.object_name)
  when 'INDEX' then (select 'PK da tabela ' || table_name from user_constraints uc where uc.CONSTRAINT_NAME = uo.object_name)
end
from user_objects uo
order by uo.object_type, uo.object_name 

Nenhum comentário :

Postar um comentário

Related Posts Plugin for WordPress, Blogger...