Oracle testing with the DUAL table

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.

Share This | Comments | Permalink | Trackback | Comments feed

One response

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

    haykimheang | 10 February 2006

Post a comment

(required)
(required)
Close
E-mail It