Invisible fields for new features of Oracle 12c

Source: Internet
Author: User
Tags table definition

In Oracle 11g R1, Oracle introduces some nice enhancements in the form of invisible indexes and virtual fields. Inheriting the former and carrying forward, Oracle 12c introduces the idea of invisible fields. In previous releases, in order to hide important data fields to avoid being displayed in generic queries, we often created a view to hide the required information or apply certain security conditions.
In 12c, you can create invisible fields in a table. When a field is defined as not visible, this field does not appear in the generic query by default unless it is explicitly mentioned in the SQL statement or condition, or there is described in the table definition. It is very easy to add or modify an invisible field, and vice versa.

Experiment:
1. Create a table that specifies passwd as an invisible field
Sql>create table invisible_t (ID int,name varchar2 (), passwd varchar2 () invisible);
2. Inserting data into the table
Sql>insert into invisible_t values (1, ' Andy ', 1);
ERROR at line 1:
Ora-00913:too Many values
sql> INSERT INTO invisible_t (ID,NAME,PASSWD) VALUES (1, ' Andy ', 1);


1 row created.
sql> INSERT INTO invisible_t (Id,name) VALUES (2, ' andy02 ');

1 row created.

3. Query status
Sql> select * from invisible_t;

ID NAME
---------- --------------------
1 Andy
2 andy02

Sql> select Id,name from invisible_t;

ID NAME
---------- --------------------
1 Andy
2 andy02

Sql> select id,name,passwd from invisible_t;

ID NAME PASSWD
---------- -------------------- --------------------
1 Andy 1
2 andy02

4. Modify field to visible or invisible field
Sql> ALTER TABLE invisible_t Modify (passwd visible);

Table altered.

Sql> select * from invisible_t;

ID NAME PASSWD
---------- -------------------- --------------------
1 Andy 1
2 andy02

Sql> ALTER TABLE invisible_t Modify (passwd invisible);

Table altered.

Sql> select * from invisible_t;

ID NAME
---------- --------------------
1 Andy
2 andy02
--not specified as invisible when created, or if you want to change to an invisible field later.
Sql> ALTER TABLE invisible_t modify (name invisible);

Table altered.

Sql> ALTER TABLE invisible_t Modify (name visible);

Table altered.

Invisible fields for new features of Oracle 12c

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.