zoukankan      html  css  js  c++  java
  • 查询表Or列的注释信息

    需求:开发人员需要DBA支持,查询表的注释说明,用于明确表的用途。

    1.测试

    session 1 创建测试表
    SQL> create table a_emp as select * from scott.emp;

    Table created.

    session 2 对测试表dml操作,事务不结束

    SQL> insert into a_emp select * from a_emp where rownum=1;

    1 row created.

      session 1 对测试表追加注释说明

    SQL> comment on table a_emp is '员工信息表';

    Comment created.

    无需申请锁资源,注释可放心使用

    
    
    session 1 对测试表的某一列追加注释说明

    SQL> comment on column sys.a_emp.empno is '员工编号';

    Comment created.

    2.查询

    ALL_TAB_COMMENTS
    ALL_COL_COMMENTS
    等comments

    select * from user_tab_comments where table_name='A_EMP'

    TABLE_NAME TABLE_TYPE COMMENTS
    -------------------- -------------------- ------------------------------
    A_EMP TABLE 员工信息表

    
    

    select * from user_col_comments where table_name='A_EMP' and COMMENTS is not null

    
    

    TABLE_NAME COLUMN_NAM COMMENTS
    ---------- ---------- ------------------------------
    A_EMP EMPNO 员工编号

     

    3.修改

    SQL> comment on column sys.a_emp.empno is 'xx';  --与追加命令相同,无异常
    
    Comment created.
  • 相关阅读:
    sqlsever中生成GUID的方法
    部署项目到服务器
    读后感
    第二次作业
    课堂作业
    第一次作业 开发环境配置介绍
    第二次结对作业
    代码审查
    最大连续子数组和
    单元测试
  • 原文地址:https://www.cnblogs.com/lvcha001/p/10202663.html
Copyright © 2011-2022 走看看