Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: What is "dual"

Re: What is "dual"

From: Nuno Souto <nsouto_at_acay.com.au>
Date: 1997/02/05
Message-ID: <32F87858.4514@acay.com.au>#1/1

Thomas Griffin wrote:
>
> Mirwais Qader wrote:
> >
> > Something that has always puzzled me is what is "dual"?
> >
> > I know (at least I think I do) it is a table of 1 row and 1 col, but
> > how is it used and what benefit is it?
> >
> > Thanks for any info.
> > PS. Please respond by email.
> >
> > -Mir.
>
> If you are writing a pl/sql block and you need the system time in a
> variable, the easiest way is to:
> select sysdate
> into :variable
> from dual;
> Since it has one row, it only returns the sysdate once.
> You can use this to many things, such as sequence numbers and current
> user.
>
> --
> Thomas Griffin
> Project Leader
> QUALITECH Systems, Inc.
> tgriffin_at_qualitech.com

Er, Thomas: PL/SQL is PRECISELY were you DON'T NEED dual!

Just do:

variable:=sysdate

and you'll get it. sysdate in PL/SQL is a valid reserved word and returns the system date (it may open an internal cursor to dual to do this, but it will be faster than you putting in the select... from dual. Outside of PL/SQL, though, or when using PL/SQL in Forms, you may need to use dual.

Just my $0.02...

Nuno Souto
nsouto_at_acay.com.au Received on Wed Feb 05 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US