oracle怎么查询数据类型
oracle查询数据类型语法如下:
select column_name,data_type,DATA_LENGTH From all_tab_columns where table_name=upper('表名') AND owner=upper('数据库登录用户名');
示例如下:
select column_name,data_type,DATA_LENGTH From all_tab_columns where table_name=upper('t_department') AND owner=upper('scott')
扩展知识:
1、看字段名与数据类型
select * from cols WHERE TABLE_name=upper('表名'); (user_tab_columns缩写cols)
2、查看指定列的数据类型
select DATA_TYPE from User_Tab_Columns t where t.column_name=upper('列名') and t.table_name =upper(trim('表名'));
3、查看全部列
select * from user_tab_columns where table_name = upper(‘表名’);
4、查看某些列
select column_name,data_type,data_length,DATA_PRECISION ,DATA_SCALE from all_tab_columns where table_name=upper('表名');
5、可以通过user_constraints查看所有约束
select * from user_constraints where table_name = upper('表名');
6、查看主键约束:
select * from user_constraints where constraint_type='P' and TABLE_name=upper('表名');