Database Reference
In-Depth Information
Figure 4.15
None of This
Information Is
Found in the
DUAL Table.
name is DUMMY, and it is a VARCHAR2(1) datatype. This does not
seem like it helps much. However, the DUAL table can be used to view
constant values, such as the USER and SYSDATE values. Because it
returns one row, you only see these values once rather than many times
(once for each row returned).
We could modify the previous query as follows. The result is shown in
Figure 4.15.
SELECT USER, UID, ROWNUM, ROWID FROM DUAL;
Some other interesting examples are as follows, where the first joins the
results from the DUAL table to a MUSIC schema table and the second out-
puts a string:
SELECT d.*, a.* FROM DUAL d, ARTIST a;
SELECT 'Hello World!' FROM DUAL;
The DUAL table is primarily used to retrieve values in a SELECT state-
ment, where a value is retrieved such as in the following examples:
SELECT SYSDATE FROM DUAL;
SELECT USER FROM DUAL;
4.3.2
Using Functions
Functions can be placed in most parts of DML and SELECT statements.
Using functions will nearly always affect performance adversely. This is
especially true for custom-written functions. Even so, functions can provide
enormous flexibility. Functions can be divided into the following listed
Search WWH ::




Custom Search