Oracle Invisible column

Starting from release 11g, Oracle has introduced good improvements with indexes invisible and virtual columns.
Invisible column concepts has been introduced in Oracle 12c.
You can now have an invisible column in a table.
When a column is defined as invisible, the column won’t appear in generic queries until the column will be explicit in the sql statement.
An example:
CREATE TABLE T_ETICA
(
cp1 NUMBER,
cp2 NUMBER,
cp3 NUMBER INVISIBLE,
cp4 NUMBER
);
Invisible columns do not appear in the output of the describe command:
SQL> DESC T_ETICA
Name Null? Type
—————————————– ——– ———————-
CP1 NUMBER
CP2 NUMBER
CP4 NUMBER
You can show the invisible column with:
SQL> SET COLINVISIBLE ON
SQL> DESCRIBE T_ETICA
Name Null? Type
—————————————– ——– ———————-
CP1 NUMBER
CP2 NUMBER
CP4 NUMBER
CP3 (INVISIBLE) NUMBER
You can specify the invisible column if you want insert a record:
SQL> INSERT INTO T_ETICA (cp1,cp2,cp3,cp4) VALUES (11,22,33,44);
1 row created.
Else …
INSERT INTO T_ETICA VALUES (11,22,33,44)
*
ERROR at line 1:
ORA-00913: too many values

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *