Method: 1. Use the select statement to match the user name and table name to query the table ID, and find out the order of all fields in the table through the ID; 2. Use "update sys.col$ set col#=3 where The obj#='table id' and name='field name'" statement can modify the field order.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
1. Query the ID of the table that needs to be changed
First requires sys or system permissions
select object_id from all_objects where owner = '当前用户名' and object_name = '表名';
The example is as follows:
Note: ITHOME is the user, TEST is the table to be changed, the table name should be in uppercase letters
Find out all fields of the table through ID The sequence of
select obj#, col#, name from sys.col$ where obj# = '第一步的object_id' order by col#;
is as follows:
2. The modification sequence of
update sys.col$ set col#=3 where obj#='第一步的object_id' and name='要修改的字段名称';
is as follows:
Or directly add for update after the statement in the third step to modify it
Finally commit and restart the Oracle service
Recommended tutorial : "Oracle Video Tutorial"
The above is the detailed content of How to modify the field order in Oracle. For more information, please follow other related articles on the PHP Chinese website!