SQL> show user
User is "admin"
SQL> create table test (id number ,xm varchar2(10));
Table created
SQL> desc test;
Name Type Nullable Default Comments
---- ------------ -------- ------- --------
ID NUMBER Y
XM VARCHAR2(10) Y
由此可见oracle表字段的显示顺序是按建表时字段顺序显示,以sys用户登录数据库查询col$表,可以看到oracle在建表时都给表列加了一个序号.
SQL> conn
sys/oracle@local as sysdba
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Connected as SYS
SQL> select obj#,col#,name from col$ where obj#=(select obj# from obj$ where name='TEST');
OBJ# COL# NAME
---------- ---------- ------------------------------
78274 1 ID
78274 2 XM
SQL> update col$ set col#=2 where obj#=78274 and name='ID';
1 row updated
SQL> update col$ set col#=1 where obj#=78274 and name='XM';
1 row updated
SQL> commit;
SQL> desc admin.test;
Name Type Nullable Default Comments
---- ------------ -------- ------- --------
XM VARCHAR2(10) Y
ID NUMBER Y
Commit complete
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26839123/viewspace-731948/
,如需转载,请注明出处,否则将追究法律责任。