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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Literal SQL and sys.dual

Re: Literal SQL and sys.dual

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Tue, 02 Apr 2002 12:23:26 -0800
Message-ID: <F001.0043923B.20020402122326@fatcity.com>


Mohammed Shakir wrote:
>
> I am working on a database optimization project. My Shared pool is
> filled with SQL like
>
> select 0 from dual;
> select 1/1 from dual;
> select 1 - 1/(2 + 2) from dual;
>
> I tried to use the bind variables to minimize the literal SQL. However
> I need a different SQL script for each case.
>
> select :b1 from dual;
> select :b1/:b2 from dual;
> select :b1 - :b2/(:b3 + :b4) from dual;
>
> first one will handle all cases for b1 from 0 to any number which is
> good. And second sql will handle all the cases for any number for b1
> and b2. So I do reduce the literal SQL. However, I need to know ahead
> of time what type of data I am calculating and then use the appropriate
> SQL.
>
> I think the easy solution would be to use arithmetic. That is to pass
> the string like ( 1 + 1 / (2 -2) ) to some function that can return me
> the result of this sting. So I would not be using SQL script, to
> minimize SQL execution, sys.dual contention or literal SQL filling
> shared pool and causing both library cache and shared pool. Not to
> mention saving in CPU processing by not parsing SQL scripts.
>
> Anybody, aware of such function in PL/SQL? Is there any other way to do
> calculations other than 'select 1 + 1 from dual' ?
>
> I would really appreciate if you could let me know.
>
> Thanks
>
> Mohammed Shakir
>
> =====
> Mohammed Shakir
> CompuSoft, Inc.
> 11 Heather Way
> East Brunswick, NJ 08816-2825
> (732) 672-0464 (Cell)
> (732) 257-6001 (Home)
>

Mohammed,

  Don't you think, before starting with a PL/SQL function of death, that it *might* be easier to check the code and see where these statements, which are unlikely to be functional requirements, are used? Rewriting the PL/SQL code around them is probably the most efficient way to get rid of them.

-- 
Regards,

Stephane Faroult
Oriole Software
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriole.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (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).
Received on Tue Apr 02 2002 - 14:23:26 CST

Original text of this message

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