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 -> PL/SQL optimization

PL/SQL optimization

From: Andrew Trubin <taa_at_eureka.vl.net.ua>
Date: Thu, 8 Oct 1998 14:18:32 +0300
Message-ID: <6viaot$781@eureka.vl.net.ua>


Hi, all!
I came into collision with a following problem. My SQL statement works fine when
it executes separately(not as cursor in PL/SQL block). It takes about 0.5 sec. to execute. But when I put it in in PL/SQL block as cursor, the statement executes about 15 mins! Maybe Oracle optimizer parses SQL statements in PL/SQL blocks differently than single SQL statements?
I'm working with Oracle 7.3.4.0.0 for SCO Unix. Here my SQL statement:

select /*+RULE PUSH_SUBQ*/
 distinct t.nparent NPARENT
from bs.bsservice s, bs.bslinkab l, bs.bsservinst si,  bs.bstechsubs ts, bs.bstechnic t, bs.vbssubscriber scb where BS.PG_BSTECHZONEINFO.F_GetZONE2(ntech_id) = 301

        and 301748 = (select nttype from bs.bstechnic where ntech_id = t.nparent)

        and 986247 <> (select nttype from bs.bstechnic where ntech_id = t.nparent)
 and l.vcodeb like '8900%'
 and l.nserv_id = s.nserv_id and si.nssinst_id = s.nssinst  and si.ntechsubs = ts.ntechsubs_id and scb.nsubs_id = ts.nsubs  and scb.npers is not null
 and trunc(s.dbegin) between to_date('01.05.98', 'dd.mm.yy') and to_date('31.05.98','dd.mm.yy')
 and ts.ntech = t.ntech_id and t.nparent is not null  and s.vtarstate = 'EX' and s.vaddserv = 'N' and s.vstate <> 'D' group by t.nparent, t.ntech_id, t.vcode having sum(nvl(s.nsum,0)) > 0; Received on Thu Oct 08 1998 - 06:18:32 CDT

Original text of this message

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