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 -> Re: Deadly sins againts database performance/scalability

Re: Deadly sins againts database performance/scalability

From: Holger Baer <holger.baer_at_science-computing.de>
Date: Fri, 28 Nov 2003 12:00:16 +0100
Message-ID: <bq79s1$o06$1@news.BelWue.DE>

> Hello,
>
> Why
> (3)
> LOOP
> EXECUTE IMMEDIATE some_sql;
> END LOOP;
> should be avoided ??
>
> OK, it's Dynamical SQL but it could be useful to write scalable batch
> scripts.
> Tell me if i'm wrong.
>
> Cheers,
> Alkos
>

If you want it truely scalable, then you would do something like this (Pseudo code following, so don't trash me for inaccuracies or not existing function/procedures - it's just supposed to give the general idea)

dbms_sql.open_cursor
dbms_sql.parse
LOOP
   dbms_sql.bind
   dbms_sql.execute
END LOOP
dbms_sql.close_cursor

This way, you avoid soft parses (and why you should avoid them is something that you will know if you hang around Tom Kytes website for a few days at http://asktom.oracle.com )

Personally, I use execute immediate only for administrative tasks. But then, I'm most of the time the DBA ;-)

Cheers,

Holger Received on Fri Nov 28 2003 - 05:00:16 CST

Original text of this message

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