RE: Simple Select Return Record

  • From: "Christian Antognini" <Christian.Antognini@xxxxxxxxxxxx>
  • To: "Vlad Sadilovskiy" <vlovsky@xxxxxxxxx>
  • Date: Thu, 9 Jun 2005 16:04:08 +0200

Hi Vlad
 

>I think it'll fetch at least batch_size(arraysize) rows.

 

It depends on your environment, e.g. with JDBC, per default, yes.

 

>Could you please kindly provide your form of the query needed. Please,

>don't say it's bad without an alternative.

 

I didn't say it's bad. In fact it's a nice trick. But fetching single rows 
instead of joining dual is still better (even in 10g with fast dual...).

An example:

 

SQL> DECLARE
  2    l_found PLS_INTEGER;
  3  BEGIN
  4    FOR i IN 1..100000 LOOP
  5      SELECT count(*)
  6      INTO l_found
  7      FROM dual
  8      WHERE EXISTS (SELECT null FROM employees WHERE employee_id = 100);
  9    END LOOP;
 10  END;
 11  /
Elapsed: 00:00:05.01

SQL> DECLARE
  2    l_found PLS_INTEGER;
  3  BEGIN
  4    FOR i IN 1..100000 LOOP
  5      l_found := 0;
  6      FOR i IN (SELECT null FROM employees WHERE employee_id = 10) LOOP
  7        l_found := 1;
  8        EXIT;
  9      END LOOP;
 10    END LOOP;
 11  END;
 12  /
Elapsed: 00:00:03.00

 

 

HTH

Chris


--
//www.freelists.org/webpage/oracle-l

Other related posts: