IBM Support

Implementing an Equivalent to the DUAL Table for Oracle Compatibility

Troubleshooting


Problem

When migrating or sharing Oracle environments, you may have used the DUAL table to test the database connection or perform basic computations.  In the Netezza database, there is no DUAL table so you may want to implement an equivalent object that returns quickly (for JDBC connection pool testing) and avoids the normal overhead of a table selection. 

Resolving The Problem

The DUAL table is defined in Oracle as a special one-row table present by default in all Oracle database installations. It is suitable for use in selecting a pseudocolumn such as SYSDATE or USER. The table has a single VARCHAR2(1) column called DUMMY that has a value of 'X'.

In Netezza, ANSI SQL allows SELECT statements without a FROM clause, and there is no DUAL table.

Therefore, you can choose to implement an equivalent to DUAL that will allow you to test the connections and perform basic selects. 

To do this, implement in each of the user's databases a view defined as follows:
CREATE VIEW DUAL AS SELECT 'X' AS DUMMY;


Creating a view means that the host will not need to access the SPUs, thus providing optimal performance.

[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Database","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

NZ024317

Document Information

Modified date:
17 October 2019

UID

swg21569584