Title: RE: Cache on sysdate? --From 9i performance planning manual
Thanks Raj.  That's very cool.  Now I can do:
 
SQL> delete from dual;
 
1 row deleted.
 
SQL> declare
  2    a date :=sysdate;
  3  begin
  4    dbms_output.put_line(to_char(a,'YYYYMMDD HH24:MI:SS'));
  5* end;
20021227 05:36:54
 
PL/SQL procedure successfully completed.
 
That further proves it no longer uses "select sysdate into a from dual;".
 
Richard Ji
-----Original Message-----
From: Jamadagni, Rajendra [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 5:14 PM
To: Multiple recipients of list ORACLE-L
Subject: RE: Cache on sysdate? --From 9i performance planning manual

Richard,

If you look in the tracefile ... there is no select from dual.  It used to be like that but things changed (as Anjo mentions maybe be around 8iR3). The sysdate call is now a C function call.

Raj
______________________________________________________
Rajendra Jamadagni              MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.
QOTD: Any clod can have facts, but having an opinion is an art!


-----Original Message-----
From: Richard Ji [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 26, 2002 3:59 PM
To: Multiple recipients of list ORACLE-L
Subject: RE: Cache on sysdate? --From 9i performance planning manual


That's because doing dt := sysdate is more optimized, it's still select
sysdate into dt from dual but more optimized.  select from dual doing 4 db
block gets in 8i and 2 db block gets in 9i, but you can tune it to cut it
down.

Richard Ji

-----Original Message-----
Sent: Thursday, December 26, 2002 2:45 PM
To: Multiple recipients of list ORACLE-L




  That's what I thought too. But the results of testing are somewhat
different.
Maybe it's evaluated within the PL/SQL engine and does not require a context

switch to the SQL engine.

Platform : Sun Solaris 2.6
Oracle   : 8.1.7.4 (32 bit)

DEV:43#14739-23049>@dual1
DEV:43#14739-23049>declare
  2    dt date;
  3  begin
  4
  5          for i in 1..10000
  6          loop
  7      select sysdate into dt from dual;
  8  --    dt := sysdate;
  9    end loop;
 10  end;
 11  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:01.97


DEV:43#14739-23049>@dual1
DEV:43#14739-23049>declare
  2    dt date;
  3  begin
  4
  5          for i in 1..10000
  6          loop
  7  --    select sysdate into dt from dual;
  8      dt := sysdate;
  9    end loop;
 10  end;
 11  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.92


Regards,
Denny

Quoting K Gopalakrishnan <[EMAIL PROTECTED]>:

> Raj:
>
> Both are same. It is internally translated as a select call to dual.
>
> KG
>
> --- "Jamadagni, Rajendra" <[EMAIL PROTECTED]> wrote:
> > Can someone please explain me why you have to use
> >
> > select sysdate
> >   from dual
> > /
> >
> > when
> >
> > my_date_Var := sysdate;
> >
> > just works fine? Maybe I am clueless ... but I can take an
> > explanation
> >
> > Raj
>
> =====
> Have a nice day !!
> ------------------------------------------------------------
> Best Regards,
> K Gopalakrishnan,
> Bangalore, INDIA.

--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Richard Ji
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to