At times you may want to re-arrange a huge set of columns within a auto generated grid to match the order of the columns from that of the source table or view. Even though it's easier to do it through the designer, It might be a time consuming task to re-arrange if the number of columns are more than 20 or so and in some cases there could be 100+ columns in a grid. In those synarios, you could execute the below SQL to update the column sequence from the backend.
UPDATE ra_ui_items t SET t.SEQ_NO = (SELECT c.column_id FROM all_tab_cols c WHERE c.table_name = '<TABLE/VIEW Name>' AND REPLACE (LOWER (c.column_name), '_', '') = t.view_attribute) WHERE t.page_id = <Page Id> AND t.parent_id = '<Grid Item ID>' AND t.view_attribute IS NOT NULL;
Note: You must change the <TABLE/VIEW Name>, <Page Id> & <Grid Item Id> with the appropriate values from your UI and execute the above SQL from the Platform Schema.