Today, while teaching a DB2 class, I was asked whether it is possible to hide all columns of a table. The rationale behind the question was that then all application developers would be forced to specify the columns during INSERT. Well, my first reaction was that at least one column needs to be visible. How does it look like?
Testing is faster than looking into the manual for IMPLICITLY HIDDEN columns, so here is a quick test:
db2 => create table hideme(id int implicitly hidden, s varchar(60) implicitly hidden)
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL20422N The statement failed because the table "HLOESER.HIDEME" would only
contain hidden columns. SQLSTATE=428GU
db2 => create table hideme(id int, s varchar(60) implicitly hidden)
DB20000I The SQL command completed successfully.
db2 => insert into hideme values(1)
DB20000I The SQL command completed successfully.
db2 => insert into hideme(id,s) values(2,'Hey')
DB20000I The SQL command completed successfully.
db2 => select * from hideme
ID
-----------
1
2
2 record(s) selected.
db2 => select id,s from hideme
ID S
----------- ------------------------------------------------------------
1 -
2 Hey
2 record(s) selected.
At least one column must be visible as assumed.