This afternoon work encountered problems, I need to put the data in a table in its backup table a_1, but the a_1 table is missing two fields, so I will add two fields, but the new field will default to the last side, and table A in the order of the field is inconsistent, then insert into a_1 SELECT * from A; Will go wrong.
A stupid method was used, as follows:
--Create a new temporary table to store the correct order
CREATE TABLE a_2 as select (column1,colum2,...... The Order in table a) from a_1;
--Delete Table a_1
drop table a_1;
--Create a new a_1 and give it the correct order and value from the a_2 table
CREATE TABLE A_1 as SELECT * from a_2;
--Delete temporary table a_2
drop table a_2;
=============
Method Two: It seems that only administrators have permission to modify
1. First, log on PL/SQL as the SYS user
2. To find out the ID of the table you want to change, take my local data for example, I want to change the ' finace ' user under the ' INCOME ' table. Note: The tables in Oracle are capitalized.
Select object_id
From All_objects
where owner = ' finace ' and
object_name = ' INCOME ';
3. Query the field in the table and the field ordinal according to the ID
Select Obj#,col#,name
From sys.col$
where obj#=73626;
For update
How to modify the field order of Oracle in PL/SQL