When a table column is defined with the implicitly hidden attribute, that column is unavailable unless it is explicitly referenced. For example, if a SELECT * query is run against a table, implicitly hidden columns are not returned in the result table. An implicitly hidden column can always be referenced explicitly wherever a column name can be specified.

In cases where columns and their entries are generated by the database manager, defining such columns as IMPLICITLY HIDDEN can minimize any potential negative impact on your applications. For example, a system-period temporal table has three columns whose values are generated by the database manager. The database manager uses these columns to preserve historical versions of each table row. Most business applications would work with the historical data, but would rarely work with these three generated columns. Hiding these columns from your applications could reduce application processing time.

When inserting data into a table, an INSERT statement without a column list does not expect values for any implicitly hidden columns. In such cases, if the input includes a value for an implicitly hidden column, that value does not have a corresponding target column and an error is returned (SQLSTATE 42802). Because an INSERT statement without a column list does not include values for implicitly hidden columns, any columns that are defined as implicitly hidden and NOT NULL must have a defined default value

When populating a table with data from an input file, utilities like IMPORT, INGEST, and LOAD require that you specify whether data for the hidden columns is included in the operation. If a column list is not specified, data movement utilities must use the implicitlyhiddeninclude or implicitlyhiddenmissing file type modifiers when working with tables that contain implicitly hidden columns. You can also use the DB2_DMU_DEFAULT registry variable to set the default behavior when data movement utilities encounter tables with implicitly hidden columns. Similarly, EXPORT requires that you specify whether data for the hidden columns is included in the operation.

The implicitly hidden attribute can be defined on a table column using the CREATE TABLE statement for new tables, or the ALTER TABLE statement for existing tables. If a table is created using a CREATE TABLE statement with the LIKE clause, any implicitly hidden columns in the source table are inherited by the new table. The ALTER TABLE statement can be used to change hidden columns to not hidden or to change not hidden columns to hidden. Altering a table to change the hidden attribute of some columns can impact the behavior of data movement utilities that are working with the table. For example, this might mean that a load operation that ran successfully before the table was altered to define some hidden columns, now returns an error (SQLCODE -2437).

The list of names identifying the columns of a result table from a SELECT query run with the exposed-name.* option does not include any implicitly hidden columns. A SELECT query run with theorder-by-clausecan include implicitly hidden columns in the simple-column-name.

If an implicitly hidden column is explicitly referenced in a materialized query table definition, that column will be a part of the materialized query table. However the column in the materialized query table does not inherit the implicitly hidden attribute. This same behaviour applies to views and tables created with the as-result-table clause.

An implicitly hidden column can be explicitly referenced in a CREATE INDEX statement, ALTER TABLE statement, or in a referential constraint.

A transition variable exists for any column defined as implicitly hidden. In the body of a trigger, a transition variable that corresponds to an implicitly hidden column can be referenced.

Implicitly hidden columns are not supported in created temporary tables and declared temporary tables.

Hidden columns for a table can be displayed using the DESCRIBE command.

DESCRIBE TABLE tablename SHOW DETAIL

Example

  • Example 1: In the following statement, a table is created with an implicitly hidden column.

         CREATE TABLE CUSTOMER
    (
    CUSTOMERNO INTEGER NOT NULL,
    CUSTOMERNAME VARCHAR(80),
    PHONENO CHAR(8) IMPLICITLY HIDDEN
    );

    ASELECT *only returns the column entries forCUSTOMERNOandCUSTOMERNAME. For example:

    A123, ACME
    B567, First Choice
    C345, National Chain

    Entries for thePHONENOcolumn are hidden unless explicitly referenced.

    SELECT CUSTOMERNO, CUSTOMERNAME, PHONENO
    FROM CUSTOMER
  • Example 2: If the database table contains implicitly hidden columns, you must specify whether data for the hidden columns is included in data movement operations. The following example uses LOAD to show the different methods to indicate if data for hidden columns is included:
    • Use insert-column to explicitly specify the columns into which data is to be inserted.

      db2 load from delfile1 of del
      insert into table1 (c1, c2, c3,...)
    • Use one of the hidden column file type modifiers: specify implicitlyhiddeninclude when the input file contains data for the hidden columns, or implicitlyhiddenmissing when the input file does not.
      db2 load from delfile1 of del modified by implicitlyhiddeninclude
      insert into table1
    • Use the DB2_DMU_DEFAULT registry variable on the server-side to set the behavior when data movement utilities encounter tables with implicitly hidden columns.
      db2set DB2_DMU_DEFAULT=IMPLICITLYHIDDENINCLUDE
      db2 load from delfile1 of del insert into table1

db2 Hidden columns的更多相关文章

  1. (转)db2top详解

    原文:https://blog.csdn.net/lyjiau/article/details/47804001 https://www.ibm.com/support/knowledgecenter ...

  2. oracle 12c中的隐含列

      Invisible Columns 使用select * from ,desc 等看不到该列, DROP TABLE tab1 PURGE; CREATE TABLE tab1 ( id NUMB ...

  3. 【转】DBMS_STATS.GATHER_TABLE_STATS详解

    转自http://blog.itpub.net/26892340/viewspace-721935/ [作用] DBMS_STATS.GATHER_TABLE_STATS统计表,列,索引的统计信息(默 ...

  4. oracle信息统计

    优化器统计范围: 表统计: --行数,块数,行平均长度:all_tables:NUM_ROWS,BLOCKS,AVG_ROW_LEN:列统计: --列中唯一值的数量(NDV),NULL值的数量,数据分 ...

  5. Sort merge join、Nested loops、Hash join(三种连接类型)

    目前为止,典型的连接类型有3种: Sort merge join(SMJ排序-合并连接):首先生产driving table需要的数据,然后对这些数据按照连接操作关联列进行排序:然后生产probed ...

  6. Oracle常用的性能诊断语句

    --1.阻塞及等待事件信息查询 -- 查询所有会话的状态.等待类型及当前正在执行的SQL脚本 select se.SID, se.SERIAL#, se.Status, se.Event, se.BL ...

  7. information_schema系列十二

    1: INNODB_SYS_VIRTUAL 表存储的是INNODB表的虚拟列的信息,当然这个还是比较简单的,我们直接通过SHOW CREATE TABLE 或者DESC TABLE就能看得到. Col ...

  8. information_schema系列四(跟踪,列约束,表和列)

    这个系列的文章主要是为了能够让自己了解MySQL5.7的一些系统表,统一做一下备注和使用,也希望分享出来让大家能够有一点点的受益. 1:KEY_COLUMN_USAGE 按照官方的解释,这个表描述的是 ...

  9. 收集oracle统计信息

    优化器统计范围: 表统计: --行数,块数,行平均长度:all_tables:NUM_ROWS,BLOCKS,AVG_ROW_LEN:列统计: --列中唯一值的数量(NDV),NULL值的数量,数据分 ...

随机推荐

  1. ubuntu 15.04 手动安装nginx 1.9.0

    平时工作也用nginx,不过用的时候都是已经配好的,只要简单改改参数就可以了.今天在自己的电脑上安装的时候发现没有想象的那么顺利. 纸上得来终觉浅,绝知此事要躬行. 正题: 1.到nginx下载页面获 ...

  2. 新建Oracle数据库时,提示使用database control配置数据库时,要求在当前oracle主目录中配置监听程序

    新建一个oracle数据库时,当提示使用database control配置数据库时,要求在当前oracle主目录中配置监听程序等字样的时候,问题是那个监听的服务没有启动,解决方法如下: 打开cmd命 ...

  3. iOS开发——高级篇——地图 MapKit

    一.简介 1.在移动互联网时代,移动app能解决用户的很多生活琐事,比如周边:找餐馆.找KTV.找电影院等等导航:根据用户设定的起点和终点,进行路线规划,并指引用户如何到达 在上述应用中,都用到了定位 ...

  4. xcode免证书开发

    工程和target的code sign 选择 ios developer 工程的team选择为none就ok 推送测试 或者 正式发布的时候要改回来, 有一个严重的缺陷, 就是打包出来的ipa程序有时 ...

  5. [BZOJ3572][Hnoi2014]世界树

    [BZOJ3572][Hnoi2014]世界树 试题描述 世界树是一棵无比巨大的树,它伸出的枝干构成了整个世界.在这里,生存着各种各样的种族和生灵,他们共同信奉着绝对公正公平的女神艾莉森,在他们的信条 ...

  6. JDBC MySQL

    JDBC连接MySQL 加载及注册JDBC驱动程序 Class.forName("com.mysql.jdbc.Driver"); Class.forName("com. ...

  7. hdu1054 树形dp&&二分图

    B - Strategic Game Time Limit:10000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u ...

  8. 4.9---二叉树路径和(CC150)

    //注意,1,要判断null:2,要注意ArrayList直接复制会被一起改变.要通过new的方式来操作.public class Solution { public static void main ...

  9. Android Service1

    一.Service的种类 按运行地点分类: 类别 区别  优点 缺点   应用 本地服务(Local) 该服务依附在主进程上,  服务依附在主进程上而不是独立的进程,这样在一定程度上节约了资源,另外L ...

  10. PHP 常量

    1.__NAMESPACE__           http://php.net/manual/zh/language.namespaces.nsconstants.php