易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle 表信息

 因为项目某些模块的数据结构设计没有严格按照某规范设计,所以只能从数据库中查询数据结构,需要查询的信息如下:字段名称、数据类型、是否为空、默认值、主键、外键等等。
在网上搜索了查询上述信息的方法,总结如下:
一,查询表基本信息
select
    utc.column_name,utc.data_type,utc.data_length,utc.data_precision,
    utc.data_Scale,utc.nullable,utc.data_default,ucc.comments
from
    user_tab_columns utc,user_col_comments ucc
where
    utc.table_name = ucc.table_name
    and utc.column_name = ucc.column_name
    and utc.table_name = 'ONLINEXLS'
order by
    column_id
注意:order by column_id的意义是使得结果按照设计数据结构时的顺序显示。
二,查询表主键
select
 col.column_name
from
 user_constraints con,user_cons_columns col
where
 con.constraint_name=col.constraint_name and con.constraint_type='P'
 and col.table_name='ONLINEXLS'
三,查询表外键
select
 distinct(ucc.column_name) column_name,rela.table_name,rela.column_name column_name1
from
 user_constraints uc,user_cons_columns ucc,
 (select t2.table_name,t2.column_name,t1.r_constraint_name from user_constraints t1,user_cons_columns t2 where t1.r_constraint_name=t2.constraint_name and t1.table_name='ONLINEXLS') rela
where
 uc.constraint_name=ucc.constraint_name
 and uc.r_constraint_name=rela.r_constraint_name
 and uc.table_name='ONLINEXLS'
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yangzhijun_cau/archive/2009/04/04/4046216.aspx


相关文档:

Oracle 优化配置 收藏

数据库系统和操作系统一样,在计算机上安装成功后,还需要进一步配置和优化,从而使其具有更强大的功能和运行在最佳状态。如果在设计阶段因为各种因素没有进行较为合理的配置和计划,那么就需要在后期对数据库系统进行优化。
数据库系统性能的优化,除了在设计阶段对其逻辑存储结构和物理存储结构设计进行优化,使之在满足 ......

Oracle 累加和实现

============================Question================================
SQL> select * from emp;
     EMPID EMPNAME                  SALARY     DEPTID
---------- ----------- ......

ORACLE 登陆错误问题

     登陆ORACLE时出现:ORA-12637 包接受失败 错误
     解决方法:在\oracle\product\10.2.0\client_1\NETWORK\ADMIN 中找到sqlnet.ora文件,
     把修改 SQLNET.AUTHENTICATION_SERVICES= (NONE)就可以了。 ......

Oracle笔记——转贴

声明:以下内容转自 http://www.weixiuwang.com/Article/server/tech/200610/22126.html
1. 查询正在执行语句的执行计划(也就是实际语句执行计划)
    select * from v$sql_plan where hash_value = (select sql_hash_value from v$session where sid = 1111);
    其中id和parent_id表示 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号