ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle中自动生成元数据SQL

oracle中自动生成元数据SQL

原创 Linux操作系统 作者:nicole_fairy 时间:2009-03-12 21:27:06 0 删除 编辑

整理偶的记事本,发现有如下SQL,看了下,正好是查询table的元数据的SQL,可能别人用得着,hoho

SELECT DECODE(tabnum,1,table_owner,NULL) AS table_owner,
DECODE(tabnum,1,table_name,NULL) AS table_name,
DECODE(tabnum,1,table_comments,NULL) AS table_comments,
col_comments
FROM (
SELECT col.owner AS table_owner,col.TABLE_NAME AS table_name,tab.COMMENTS AS table_comments, col.COMMENTS AS col_comments ,
row_number() OVER (PARTITION BY tab.owner,tab.TABLE_NAME ORDER BY tab.owner) AS tabnum
FROM dba_col_comments col, dba_tab_comments tab
WHERE col.owner=tab.owner
AND col.table_name=tab.table_name
AND col.owner='NINI' AND col.table_name ='TEST_OBJ'
)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12125877/viewspace-567104/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-06-01

  • 博文量
    32
  • 访问量
    125352