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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SELECT from DUAL??

Re: SELECT from DUAL??

From: Stephan Born <stephan.born_at_beusen.de>
Date: Thu, 18 Jan 2001 08:42:51 +0100
Message-ID: <3A669E7B.15A7DF31@beusen.de>

Joseph Ranseth wrote:
>
> I have come across many instances where people use a select from dual to
> determine or assign a value to a local variable, for example:
>
> SELECT sysdateinto l_date FROM dual
>
> what is the benefit of this over using a standard assignment expression?
> ie: l_date := sysdate;

if you want to get a new value fron a sequence you cant do the following:

declare

   new_val number;
begin

   new_val := my_sequence.nextval;
end;

You have to do it this way

declare

   new_val number;
begin

   select my_sequence.nextval into new_val from dual; end;

The same with decode(...)

At least in Oracle7

Regards, Stephan Received on Thu Jan 18 2001 - 01:42:51 CST

Original text of this message

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