Advertisement
ExaGridDba

add column to middle of 12c table

Jan 13th, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. SQL*Plus: Release 12.1.0.1.0 Production on Mon Jan 13 22:55:03 2014
  2.  
  3. Copyright (c) 1982, 2013, Oracle. All rights reserved.
  4.  
  5. Last Successful login time: Mon Jan 13 2014 22:46:01 -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 trimspool on
  13. SQL> set numformat 99
  14. SQL> column column_name format a2
  15.  
  16. SQL> create table tbl
  17. 2 (
  18. 3 m number,
  19. 4 i number,
  20. 5 l number,
  21. 6 e number
  22. 7 );
  23.  
  24. Table created.
  25.  
  26. SQL>
  27. SQL> insert into tbl values ( 1, 1, 0, 0);
  28.  
  29. 1 row created.
  30.  
  31. SQL> alter table tbl modify ( l invisible, e invisible );
  32.  
  33. Table altered.
  34.  
  35. SQL> alter table tbl add dd number;
  36.  
  37. Table altered.
  38.  
  39. SQL> alter table tbl modify ( l visible, e visible );
  40.  
  41. Table altered.
  42.  
  43. SQL> select * from tbl;
  44.  
  45. M I DD L E
  46. --- --- --- --- ---
  47. 1 1 0 0
  48.  
  49. SQL> select column_name, column_id, hidden_column, segment_column_id, internal_column_id
  50. 2 from user_tab_cols
  51. 3 where table_name = 'TBL'
  52. 4 order by column_id
  53. 5 ;
  54.  
  55. CO COLUMN_ID HID SEGMENT_COLUMN_ID INTERNAL_COLUMN_ID
  56. -- --------- --- ----------------- ------------------
  57. M 1 NO 1 1
  58. I 2 NO 2 2
  59. DD 3 NO 5 5
  60. L 4 NO 3 3
  61. E 5 NO 4 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement