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 -> SELECT ... FROM DUAL ?

SELECT ... FROM DUAL ?

From: <pbolduc_at_my-deja.com>
Date: Fri, 17 Sep 1999 07:40:42 GMT
Message-ID: <7rsr9q$pr8$1@nnrp1.deja.com>


I have seen PL/SQL code (see
http://www.oracle.com/oramag/code/cod02189.html) such as:

         SELECT SUBSTR (vissuedt, 3, 3) INTO vmonth FROM dual;

my question is: would not this be more efficient written as:

       vmonth := SUBSTR(vissuedt,3,3);

Due to my understanding there is a small, but definate cost from switching from PL/SQL context to SQL context. I understand with things like sequences need to be selected from DUAL.

PL/SQL code I have seen and wanted to change right away:

    SELECT USER INTO v_username FROM dual;

    SELECT TRUNC(SYSDATE) INTO v_today FROM DUAL;

Perhaps I am just being picky.

Phil Bolduc
North Vancouver, Canada

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Fri Sep 17 1999 - 02:40:42 CDT

Original text of this message

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