DB2 10.5 for Linux, UNIX, and Windows

DUAL table

Any unqualified reference to the DUAL table is resolved as a built-in view that returns one row and one column that is named DUMMY, whose value is 'X'.

Enablement

You enable DUAL table support by setting of the DB2_COMPATIBILITY_VECTOR registry variable to hexadecimal value 0x02 (bit position 2), and then stop and restart the instance to have the new setting take effect.
db2set DB2_COMPATIBILITY_VECTOR=02
db2stop
db2start

To take full advantage of the DB2 compatibility features for Oracle applications, the recommended setting for the DB2_COMPATIBILITY_VECTOR is ORA, which sets all of the compatibility bits.

Unqualified table references to the DUAL table are resolved as SYSIBM.DUAL.

If a user-defined table named DUAL exists, the DB2® server resolves a table reference to the user-defined table.

Example 1

Generate a random number by selecting from DUAL.
   SELECT RAND() AS RANDOM_NUMBER FROM DUAL

Example 2

Retrieve the value of the CURRENT SCHEMA special register.
   SET SCHEMA = MYSCHEMA;
   SELECT CURRENT SCHEMA AS CURRENT_SCHEMA FROM DUAL;