Monday, May 16, 2011

Overview: DB2 Base Tables, Created Temporary Tables and Declared Temporary Tables

One of the new features in DB2 9.7 are "Created Temporary Tables". Previously, users had to distinguish between the base tables (in all different forms and shapes) and declared temporary tables. So what are the commonalities and differences between the three different types of table that are now supported in DB2?

Fortunately, as in most cases, there is the DB2 Information Center. For exactly my question above there is an excellent overview (in table format!) that compares the three table types by feature category. Did you know that all support indexes on them or that you have to specify LOGGING for temporary tables in order to support UNDO operations?

For a reference of the syntax, see here:
CREATE TABLE
CREATE GLOBAL TEMPORARY TABLE
DECLARE GLOBAL TEMPORARY TABLE