oracle取得的注释与select的字段顺序不一样

  • A+
所属分类:oracle
select  COMMENTS from user_col_comments where table_name='USER'

用上面的SQL语句取得的字段的注释与select * from user取出的字段的顺序不一致。

用下面的sql可以解决

select
  a.COMMENTS
from
  user_col_comments a 
  inner join user_tab_columns b 
    on ( 
      a.table_name = b.table_name 
      and a.column_name = b.column_name
    ) 
where
  a.table_name = 'USER' 
order by
  b.column_id

 

ZPY

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: