Oracle查询一个用户的所有表的结构信息的SQL语句
2013-05-27 00:58
776 查看
选择出的信息结果:表名 说明
选择出的信息结果:表名(备注)、列名、列标注、主键、外键、字段类型、长度、小数位数、是否允许空、默认值
select user_tab_comments.table_name as 表名,user_tab_comments.comments as 说明 from user_tab_comments
选择出的信息结果:表名(备注)、列名、列标注、主键、外键、字段类型、长度、小数位数、是否允许空、默认值
select case when user_tab_comments.comments is null then a.table_name else a.table_name||'('||user_tab_comments.comments||')' end as 表名(备注), a.column_name as 列名, f.comments as 列标注, decode(e.key1, 'P', '√', '') as 主键, decode(e.key2, 'R', '√', '') as 外键, a.data_type as 字段类型, NVL(decode(a.data_type, 'NUMBER', a.data_precision, a.data_length),0) as 长度, NVL(a.data_scale,0) as 小数位数, a.nullable as 是否为空, a.data_default as 默认值 from user_tab_columns a, user_col_comments f, user_tab_comments, ( select uc.table_name, uc.constraint_name, ucc.column_name, uc.constraint_type key1, uc.constraint_type key2 from user_constraints uc, user_cons_columns ucc where (uc.constraint_type='R'or uc.constraint_type='P') and uc.constraint_name=ucc.constraint_name and uc.owner=ucc.owner and uc.table_name=ucc.table_name and ucc.table_name not like 'BIN$%==$0' ) e where a.table_name = e.table_name(+) and a.column_name = e.column_name(+) and a.table_name = f.table_name and a.column_name = f.column_name and a.table_name = user_tab_comments.table_name and a.table_name not like 'BIN$%==$0' order by a.table_name
相关文章推荐
- ORACLE--查询当前连接的用户信息及操作的SQL语句
- oracle 导出当前用户下表结构信息 sql语句
- oracle 中查询一个表的所有字段名以及属性的sql语句应该怎么写?
- oracle sql查询 当前用户的所有表的字段信息
- ORACLE查询当前连接的用户信息及操作的SQL语句
- 查询oracle中所有用户信息
- 使用SQL语句查询数据库信息及表结构
- 一个每日生产指标的ORACLE SQL查询语句(备忘录)
- [置顶]一个查看MSSQL数据库中所有表信息的SQL语句
- 如何查询Oracle中所有用户信息
- Oracle—查询所有用户信息
- oracle查询用户所有表的语句
- oracle联合查询并更新一个表字段的sql语句
- 查询oracle中所有用户信息
- Oracle中快速查询和操作某个用户下的所有表数据信息
- 用SQL语句查询出所有表的表结构(字段定义,类型,长度等),导出CSV(SQL2008 R2)
- 查询所有SQL用户的连接信息(可显示IP)
- SqlServer和Oracle从多行记录(数据集)中查询结果并拼接成一个字符串的SQL语句(纵表数据转成拼接的文本)
- 查询oracle中所有用户信息
- 根据系统表查询用户方案下所有对象信息的用例语句