[Dbix-class] select from dual
Jess Robinson
castaway at desert-island.demon.co.uk
Wed Jul 19 10:36:12 CEST 2006
On Mon, 17 Jul 2006, Joel Bernstein wrote:
> On Sun, Jul 16, 2006 at 11:20:32PM +0100, Jess Robinson wrote:
>> What did you need it for?
>
> In Oracle, SELECT...FROM dual; is the construct by which certain system
> constant parameters are checked. Dual is part of (or at least, created
> at the same time as) the data dictionary, it has a single record with a
> single column called dummy. It's typically used like (for example):
> SELECT sysdate FROM dual;
>
> Dual is effectively there to give the Oracle Optimizer a clue about how
> to deal efficiently with queries involving those expressions in which it
> is used. I'd hazard a guess that the OP only needs it for date
> manipulation queries involving the DB system date, and that these may be
> better made using one of the Oracle-specific control modules than via
> DBIC. But obviously TMTOWTDI.
>
> /joel
>
Yup, I know what the DUAL table is.. or I thought I did, didn't realise
it's the only way to get/set some system whatsits.. silly Oracle..
(Incidentally, DB2 has: VALUES(some expression), and select
someexpression from sysdummy1 .. but you didn't want to know that, did
you?)
Jess
More information about the Dbix-class
mailing list