1.查询表的相关信息

查询结果如下:

查询脚本如下:

select tt1.owner,tt1.table_name,tt1.comments,tt1.last_analyzed,tt1.num_rows,tt2.colcntfrom (select t1.owner,t1.table_name,c1.comments,t1.last_analyzed,t1.num_rowsfrom all_tables t1, ALL_TAB_COMMENTS c1where t1.owner = c1.ownerand t1.table_name = c1.table_name) tt1,(select t5.OWNER, t5.TABLE_NAME, count(1) as colcntfrom dba_tab_columns t5where t5.OWNER not in('SYS', 'SYSTEM', 'OUTLN', 'DIP', 'ORACLE_OCM', 'DBSNMP','APPQOSSYS', 'WMSYS', 'EXFSYS', 'CTXSYS', 'XDB', 'ANONYMOUS','ORDSYS', 'ORDDATA', 'ORDPLUGINS', 'SI_INFORMTN_SCHEMA','MDSYS', 'OLAPSYS', 'MDDATA', 'SPATIAL_WFS_ADMIN_USR','SPATIAL_CSW_ADMIN_USR', 'SYSMAN', 'MGMT_VIEW', 'FLOWS_FILES','APEX_PUBLIC_USER', 'APEX_030200', 'OWBSYS', 'OWBSYS_AUDIT','SCOTT', 'HR', 'OE', 'IX', 'SH', 'PM', 'BI', 'XS$NULL')group by t5.OWNER, t5.TABLE_NAME) tt2where tt1.owner = tt2.ownerand tt1.table_name = tt2.table_nameorder by tt1.owner, tt1.table_name

  

2.查询字段相关信息 

查询结果如下:

查询脚本如下:

select ttt1.owner,ttt1.table_name,ttt1.column_name,ttt1.DATA_TYPE,ttt1.comments,(case ttt2.constraint_typewhen 'P' THEN'Y'ELSE'N'END) "是否主键",(case ttt3.constraint_typewhen 'R' THEN'Y'ELSE'N'END) "是否外键",(case ttt4.constraint_typewhen 'U' THEN'Y'ELSE'N'END) "是否唯一值",ttt1.NULLABLEfrom (select tt1.owner,tt1.table_name,tt1.column_name,tt1.DATA_TYPE,tt1.COLUMN_ID,tt2.comments,tt1.NULLABLEfrom (select t2.owner,t2.table_name,t2.column_name,t2.DATA_TYPE,t2.COLUMN_ID,t2.NULLABLEfrom all_tab_columns t2where t2.owner not in('SYS', 'SYSTEM', 'OUTLN', 'DIP', 'ORACLE_OCM','DBSNMP', 'APPQOSSYS', 'WMSYS', 'EXFSYS', 'CTXSYS','XDB', 'ANONYMOUS', 'ORDSYS', 'ORDDATA', 'ORDPLUGINS','SI_INFORMTN_SCHEMA', 'MDSYS', 'OLAPSYS', 'MDDATA','SPATIAL_WFS_ADMIN_USR', 'SPATIAL_CSW_ADMIN_USR','SYSMAN', 'MGMT_VIEW', 'FLOWS_FILES','APEX_PUBLIC_USER', 'APEX_030200', 'OWBSYS','OWBSYS_AUDIT', 'SCOTT', 'HR', 'OE', 'IX', 'SH', 'PM', 'BI','XS$NULL')) tt1,ALL_COL_COMMENTS tt2where tt1.owner = tt2.ownerand tt1.table_name = tt2.table_nameand tt1.column_name = tt2.column_name) ttt1left join(select col.owner, col.table_name, col.column_name, con.constraint_typefrom all_constraints con, all_cons_columns colwhere con.constraint_name = col.constraint_nameand con.owner = col.ownerand con.table_name = col.table_nameand con.constraint_type = 'P') ttt2 on ttt1.owner = ttt2.ownerand ttt1.table_name =ttt2.table_nameand ttt1.column_name =ttt2.column_nameleft join(select col.owner, col.table_name, col.column_name, con.constraint_typefrom all_constraints con, all_cons_columns colwhere con.constraint_name = col.constraint_nameand con.owner = col.ownerand con.table_name = col.table_nameand con.constraint_type = 'R') ttt3 on ttt1.owner = ttt3.ownerand ttt1.table_name =ttt3.table_nameand ttt1.column_name =ttt3.column_nameleft join(select col.owner, col.table_name, col.column_name, con.constraint_typefrom all_constraints con, all_cons_columns colwhere con.constraint_name = col.constraint_nameand con.owner = col.ownerand con.table_name = col.table_nameand con.constraint_type = 'U') ttt4 on ttt1.owner = ttt4.ownerand ttt1.table_name =ttt4.table_nameand ttt1.column_name =ttt4.column_nameorder by ttt1.owner, ttt1.table_name, ttt1.COLUMN_ID

  

Oracle 数据字典查询相关推荐

  1. oracle 数据字典画报,Oracle 数据字典查询

    1.查询表的相关信息 查询结果如下: 查询脚本如下: select tt1.owner, tt1.table_name, tt1.comments, tt1.last_analyzed, tt1.nu ...

  2. Oracle数据字典的查询语句

    数据库开发中,经常需要提取不同的数据字典,现将常用到的Oracle数据字典查询语句分享 1.查询当前登录数据库用户下的所有表 SELECT * FROM USER_TABLES 2.查询当前登录数据库 ...

  3. oracle hive 数据类型,查询oracle数据字典,并对应出hive的数据类型

    SQL开始 select t2.owner||'.'||t2.TABLE_NAME 源表名, 'dl_{0}_seq.'||'tt_{1}_'||lower(t2.table_name) hive表名 ...

  4. oracle查看字典结构体,Oracle数据字典的实操

    以下的文章主要是介绍Oracle sqlplus命令中用户有效地利用Oracle数据字典的方案,我们大家都知道Oracle数据字典作为数据库的重要的组成部分之一,是随着数据库的产生而产生, 随着数据库 ...

  5. oracle数据字典表与视图

    oracle数据字典表与视图 数据字典是数据的数据,也就是元数据.描述了数据库的物理与逻辑存储与相应的信息.模式中对象的定义信息,安全信息,完整性约束信息,和部分的性能监控信息等.数据字典表 与视图存 ...

  6. Oracle 数据字典表 -- SYS.COL$

    一. 数据字典表SYS.COL$ 说明 Oracle 的数据字典分两类,一个数据字典表,另一个是数据字典视图. 数据字典表里的数据是Oracle系统存放的系统数据,而普通表存放的是用户的数据.为了方便 ...

  7. Oracle数据字典中查看约束信息/约束相关笔记

    1.我们创建的对象可以从"USER_"开通的视图中查看.如果在模式中创建了10张表,那么从USER_TABLES中查询将返回10行,每一行是关于一张表的特性信息 USER_TABL ...

  8. Oracle数据字典全解 (1)

    Oracle数据字典全解 2011-08-18 20:59:41|  分类: Oracle |  标签:oracle   |字号 订阅 一.概念: 1.数据字典(data dictionary)是 O ...

  9. Oracle数据字典使用

    Oracle数据字典使用 一.数据字典 二.数据字典相关查询 1. 查询用户 2.查询 表空间 (拥有DBA权限的用户才能查询) 3.查询数据库对象(拥有DBA权限的用户才能查询) 4.查询表.[^1 ...

最新文章

  1. 神经网络与中心场近似
  2. java swing removeall_Java Swing Combobox removeAllItems调用ItemStateChange...
  3. django的sqlite3的使用_2_第一个模型
  4. Effective Java之慎用可变参数(四十二)
  5. java数组的调用_java中数组的应用及方法
  6. java实现次方的运算_Java中对于位运算的优化以及运用与思考
  7. oem是代工还是贴牌_代加工和贴牌加工的区别是什么
  8. jstack会导致JVM停顿
  9. 标准商业计划书大纲模版
  10. 商场抽奖软件 android,召唤抽奖系统
  11. echarts 画中国地图
  12. 华东地区响应最快的DNS服务排名
  13. 频谱、频谱密度、能量谱密度、功率谱密度
  14. 国务院办公厅关于2014年部分节假日安排的通知
  15. 自定义控件从入门到轻生之---解锁新姿势
  16. taro安装踩坑记录
  17. 由PVID引起的故障现象
  18. SaaS安全性(摘自百科)
  19. 新时达服务器显示下行限位,新时达STEP系统调试说明
  20. win7官方原版iso镜像_原版下载!Windows 10 v1903简体中文官方ISO镜像

热门文章

  1. mac系统常用操作指南
  2. python公众号文章爬虫_拒绝低效!Python教你爬虫公众号文章和链接
  3. 交叉熵cross_entropy的python实现
  4. 写计算机知识大全的结尾怎么写,写事作文开头结尾大全
  5. 浅谈基于UDS的ECU刷写方案(Bootloader刷新)
  6. 自己动手搭建NAS(一)|简介
  7. 微信小程序3(WXSS模板样式和全局局部配置)
  8. mysql ddl ddm_ddm 排行_大智慧DDL DDM排序源码
  9. ArrayList 源码分析
  10. spark程序运行异常:java.lang.OutOfMemoryError: GC overhead limit exceeded