一、 SQLPLUS中,直接用 DESC[ribe] tablename 即可。
二、在外部应用程序调用查看ORACLE中的表结构时,只能用下面的语句代替:
1、看字段名与数据类型
select * from cols
WHERE TABLE_name=upper('table_name'); --(user_tab_columns缩写cols)
2、查看全部列
select * from user_tab_columns
where table_name = upper(‘tablename’);
3、查看某些列
select column_name,data_type,data_length,DATA_PRECISION ,DATA_SCALE
from all_tab_columns
where table_name=upper('tablename');
4、查看指定列的数据类型
select DATA_TYPE
from User_Tab_Columns t
where t.column_name=upper('FIELDA列名')
and t.table_name =upper(trim('TEST2表名'));
5、通过user_constraints查看所有约束
select * from user_constraints where table_name = upper('tablename');
6、查看主键约束:
select * from user_constraints where constraint_type='P' and TABLE_name=upper('table_name');