Thursday, 25 July 2013

Oracle Database 12c R1 New Features - Invisible columns

Oracle Database 12c R1 New Features - Invisible columns

In Oracle Database 12c R1, you can now have an invisible column in a table. When a column is defined as invisible, the column does not appear in generic queries, unless the column is explicitly referred to in the SQL statement or condition, or DESCRIBED in the table definition. You can add or modify a column to be invisible and vice versa.

You must explicitly refer to the invisible column name with the INSERT statement to insert the database into invisible columns. A virtual column or partition column can be defined as invisible too. However, temporary tables, external tables and cluster tables won’t support invisible columns.


Example:

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions

SQL> CREATE TABLE EMP_RECORDS
  2  (EMP_NO number (5),
  3  EMP_NAME varchar2 (30),
  4  EMP_SAL number (6) INVISIBLE)
  5  /

Table created.

SQL> desc EMP_RECORDS;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------

 EMP_NO                                             NUMBER(5)
 EMP_NAME                                       VARCHAR2(30)


SQL> alter table emp_records
  2  modify (emp_sal visible)
  3  /

Table altered.

SQL> desc emp_records
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------

 EMP_NO                                             NUMBER(5)
 EMP_NAME                                       VARCHAR2(30)
 EMP_SAL                                            NUMBER(6)

Related:

Installing Oracle Database 12c R1 (12.1.0.1.0)

Oracle Database 12c R1 New Features - Multiple Indexes on the same column or set of columns

No comments:

Post a Comment