select COLUMN_NAME 列名,comments 注释 from user_col_comments where table_name ='表名';SELECT*FROM user_tab_comments;
–查询表的字段类型及字段长度
select column_name,data_type,DATA_LENGTH From all_tab_columns where table_name=upper('表名') AND owner=upper('用户名');
–查询表名注释
SELECT
a.TABLE_NAME,b.COMMENTS
FROM
user_tables a,user_tab_comments b
WHERE
a.TABLE_NAME=b.TABLE_NAME
AND a.TABLE_NAME ='表名[大写]'#不加这个条件就是查所有ORDERBY
TABLE_NAME
selecT table_name,column_name,comments from user_col_comments where table_name='视图名[大写]';
–删除视图
DROPVIEW schema_name.view_name ;
–查看视图名注释
select a.view_NAME, b.COMMENTS from user_views a,user_tab_comments b WHERE a.view_NAME= b.TABLE_NAME
orderby TABLE_NAME
–修改视图名注释
commentontable 视图名[大写]is'视图注释';
–查询函数的内容
SELECT*FROM dba_objects WHERE object_type='FUNCTION'and owner='用户名';SELECT dbms_lob.substr(DBMS_METADATA.GET_DDL('FUNCTION','函数名[大写]','用户名'))FROM dual;selecttextfrom user_source where name='函数名[大写]';
//查询select a.constraint_name, a.column_name from user_cons_columns a, user_constraints b where a.constraint_name = b.constraint_name
and b.constraint_type ='P'and a.table_name ='表名[大写]';//添加altertable 表名[大写]addconstraint 主键名 primarykey(列名);//删除altertable 表名[大写]dropconstraint 主键名;