Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

12c: reorder the columns in a table! Wow!

ExaGridDba Jan 13th, 2014 102 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. SQL*Plus: Release 12.1.0.1.0 Production on Mon Jan 13 22:02:35 2014
  2.  
  3. Copyright (c) 1982, 2013, Oracle.  All rights reserved.
  4.  
  5. Last Successful login time: Mon Jan 13 2014 22:01:16 -05:00
  6.  
  7. Connected to:
  8. Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
  9. With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
  10. and Real Application Testing options
  11.  
  12. SQL> set linesize 200
  13. SQL> set trimspool on
  14. SQL> set numformat 99
  15. SQL> column column_name format a1
  16.  
  17. SQL> create table brian
  18.   2  (
  19.   3          i number,
  20.   4          d number,
  21.   5          a number,
  22.   6          l number,
  23.   7          f number,
  24.   8          e number,
  25.   9          t number,
  26.  10          r number,
  27.  11          g number,
  28.  12          z number
  29.  13  );
  30.  
  31. Table created.
  32.  
  33. SQL>
  34. SQL> insert into brian values ( 1, 55, 21, 34, 1, 8, 2, 13, 5, 3);
  35.  
  36. 1 row created.
  37.  
  38. SQL>
  39. SQL> alter table brian modify i invisible;
  40.  
  41. Table altered.
  42.  
  43. SQL> alter table brian modify i visible;
  44.  
  45. Table altered.
  46.  
  47. SQL> alter table brian modify d invisible;
  48.  
  49. Table altered.
  50.  
  51. SQL> alter table brian modify a invisible;
  52.  
  53. Table altered.
  54.  
  55. SQL> alter table brian modify l invisible;
  56.  
  57. Table altered.
  58.  
  59. SQL> alter table brian modify e invisible;
  60.  
  61. Table altered.
  62.  
  63. SQL> alter table brian modify t invisible;
  64.  
  65. Table altered.
  66.  
  67. SQL> alter table brian modify t visible;
  68.  
  69. Table altered.
  70.  
  71. SQL> alter table brian modify z invisible;
  72.  
  73. Table altered.
  74.  
  75. SQL> alter table brian modify z visible;
  76.  
  77. Table altered.
  78.  
  79. SQL> alter table brian modify g invisible;
  80.  
  81. Table altered.
  82.  
  83. SQL> alter table brian modify r invisible;
  84.  
  85. Table altered.
  86.  
  87. SQL> alter table brian modify g visible;
  88.  
  89. Table altered.
  90.  
  91. SQL> alter table brian modify e visible;
  92.  
  93. Table altered.
  94.  
  95. SQL> alter table brian modify r visible;
  96.  
  97. Table altered.
  98.  
  99. SQL> alter table brian modify a visible;
  100.  
  101. Table altered.
  102.  
  103. SQL> alter table brian modify l visible;
  104.  
  105. Table altered.
  106.  
  107. SQL> alter table brian modify d visible;
  108.  
  109. Table altered.
  110.  
  111. SQL>
  112. SQL> select * from brian;
  113.  
  114.   F   I   T   Z   G   E   R   A   L   D
  115. --- --- --- --- --- --- --- --- --- ---
  116.   1   1   2   3   5   8  13  21  34  55
  117.  
  118. SQL> select column_name, column_id, hidden_column, segment_column_id, internal_column_id
  119.   2  from user_tab_cols
  120.   3  where table_name = 'BRIAN'
  121.   4  order by internal_column_id
  122.   5  ;
  123.  
  124. C COLUMN_ID HID SEGMENT_COLUMN_ID INTERNAL_COLUMN_ID
  125. - --------- --- ----------------- ------------------
  126. I         2 NO                  1                  1
  127. D        10 NO                  2                  2
  128. A         8 NO                  3                  3
  129. L         9 NO                  4                  4
  130. F         1 NO                  5                  5
  131. E         6 NO                  6                  6
  132. T         3 NO                  7                  7
  133. R         7 NO                  8                  8
  134. G         5 NO                  9                  9
  135. Z         4 NO                 10                 10
  136.  
  137. 10 rows selected.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top