Oracle查看表结构的几种方法
- - CSDN博客数据库推荐文章1,DESCRIBE 命令. SQL> describe nchar_tst(nchar_tst为表名). 名称 是否为空. NAME NCHAR(6).
SQL> SELECT DBMS_METADATA.GET_DDL('TABLE','NCHAR_TST') FROM DUAL;如果显示的结果并未完整,如下:
那么修改如下:
SQL> SET LONG 9999 SQL> SELECT DBMS_METADATA.GET_DDL('TABLE','NCHAR_TST') FROM DUAL;
则显示如下的结果:
DBMS_METADATA.GET_DDL('TABLE','NCHAR_TST')select t.table_name,t.column_name,t.data_type,t.data_length,t.nullable,t.column_id,c.comments, (SELECT CASE WHEN t.column_name=m.column_name THEN 1 ELSE 0 END FROM DUAL) iskey FROM user_tab_cols t, user_col_comments c, (select m.column_name from user_constraints s, user_cons_columns m where lower(m.table_name)='us_cities' and m.table_name=s.table_name and m.constraint_name=s.constraint_name and s.constraint_type='P') m WHERE lower(t.table_name)='us_cities' and c.table_name=t.table_name and c.column_name=t.column_name and t.hidden_column='NO' order by t.column_id