ORACLE INVISIBLE Column can be used for column ordering

How to reorder ORACLE table columns?

Sample table

CREATE TABLE TEST_COLUMN
(
ID NUMBER,
NAME VARCHAR2(200)
CREATED_BY VARCHAR2(50)
);

Add a column

ALTER TABLE TEST_COLUMN ADD EMAIL VARCHAR2(50);

Column Order will be

  • ID
  • NAME
  • CREATED_BY
  • EMAIL

Reorder Email next to NAME.

ALTER TABLE TEST_COLUMN MODIFY CREATED_BY INVISIBLE; 
ALTER TABLE TEST_COLUMN MODIFY CREATED_BY VISIBLE; 

After doing so we get the table columns reordered

Column Order will be

  • ID
  • NAME
  • EMAIL
  • CREATED_BY

comments powered by Disqus