如何查看oracle表中列的数据类型

1、看字段名与数据类型  

select   *   from   cols     WHERE   TABLE_name=upper('表名');  (user_tab_columns缩写cols)

2、查看全部列

select   *   from   user_tab_columns   where   table_name   =   upper(‘表名’); 

3、查看某些列

select  column_name,data_type,data_length,DATA_PRECISION ,DATA_SCALE  from all_tab_columns  where table_name=upper('表名');

4、查看指定列的数据类型

select DATA_TYPE from User_Tab_Columns t where t.column_name=upper('列名') and t.table_name =upper(trim('表名'));

5、可以通过user_constraints查看所有约束  

select   *   from   user_constraints  where  table_name   =   upper('表名'); 

6、查看主键约束:   

select   *   from   user_constraints   where   constraint_type='P'   
and   TABLE_name=upper('表名');

猜你喜欢

转载自lilixu.iteye.com/blog/2094790