Oracle testing with the DUAL table

Tuesday, 2 September 2003

This feature is a hack intended for testing, but it’s built in to every Oracle installation.

DUAL is a table automatically created by Oracle and accessible to all users. It has one column, DUMMY, containing one row. It’s useful for selecting a constant or expression, because the table always exists (so the query will succeed) and the result will only be returned once (since there’s exactly one row in the table).

For example:

SELECT ASCII('A') FROM DUAL;
 
ASCII('A')
----------
        65

See the Oracle 8 manual, section 5-28 (registration required) for more details.

Tags: ,

One comment

You can leave a comment, or trackback from your own site.

  1. hi , i’m a cambodian student , living in hanoi ,vietnam ,

Leave a comment