Adjust the order of table fields in Oracle databases

Source: Internet
Author: User
Step 1: query the idselectobject_idfromall_objectswhereowner of the table from the data dictionary view.

Step 1: query the table id from the data dictionary view select object_id from all_objects where owner =

Step 1: query the table id from the data dictionary View

Select object_id from all_objects where owner = 'sunard' and object_name = 'tbl _ WDC_INF ';

Step 2: Identify the order of all fields in the table by id

Select obj #, col #, name from sys. col $ where obj # = 89677;

Step 3: update the field order

Update sys. col $ set col # = 0 where obj # = 89677 and;
Update sys. col $ set col # = 7 where obj # = 89677 and;
Update sys. col $ set col # = 9 where obj # = 89677 and;
Update sys. col $ set col # = 4 where obj # = 89677 and;
Update sys. col $ set col # = 3 where obj # = 89677 and;


Update sys. col $ set col # = 8 where obj # = 89677 and;
Update sys. col $ set col # = 5 where obj # = 89677 and;
Update sys. col $ set col # = 2 where obj # = 89677 and;

Update sys. col $ set col # = 1 where obj # = 89677 and;

Note: The preceding update requires DBA permission.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.