Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Invisible Column In Oracle 12c

$
0
0


Invisible Column In Oracle 12c

We have invisible indexes in oracle 11g. But in oracle 12c we invisible column was introduced.

DEMO:


Lets create a normal table:

SQL> create table dbatest ( empno number, name varchar2(10));

Table created.


SQL> insert into dbatest values ( 1,'TEST1');

1 row created.

SQL> insert into dbatest values ( 2,'TEST2');

1 row created.

SQL> commit;

Commit complete.


SQL> ;
  1* select owner,table_name,column_name,hidden_column from dba_tab_cols where table_name='DBATEST'
SQL> /

OWNER  TABLE_NAME COLUMN_NAM HID
--------- ---------- ---------- ---
TEST  DBATEST    EMPNO NO
TEST  DBATEST    NAME NO


Make a column invisible:


SQL> alter table dbatest modify ( NAME invisible);

Table altered.

SQL> select owner,table_name,column_name,hidden_column from dba_tab_cols where table_name='DBATEST';

OWNER  TABLE_NAME COLUMN_NAM HID
--------- ---------- ---------- ---
TEST  DBATEST    EMPNO NO
TEST  DBATEST    NAME YES

SQL> select * from dbatest;

     EMPNO
----------
 1
 2

 Now the column “NAME” is invisible to application. And we if create another table from this table, then invisible column won’t be created.


 SQL> create table dbaprod as select * from dbatest;

Table created.


SQL> select * from dbaprod;

     EMPNO
----------
 1
 2



 But still you can access the data of invisible column by specifically using the column_name.


 SQL> select empno, name from dbatest;

     EMPNO NAME
---------- ----------
 1 TEST1
 2 TEST2


 SQL> alter table dbatest modify ( name visible);

Table altered.

SQL>  select owner,table_name,column_name,hidden_column from dba_tab_cols where table_name='DBATEST';

OWNER  TABLE_NAME COLUMN_NAM HID
--------- ---------- ---------- ---
TEST  DBATEST    EMPNO NO
TEST  DBATEST    NAME NO


Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>