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 -> What is the fastest/easiest way to find a row in a PL/SQL table

What is the fastest/easiest way to find a row in a PL/SQL table

From: Rod J. Stewart <rstewart_at_eucalypt.net.au>
Date: 12 Feb 2002 01:16:45 -0800
Message-ID: <dd07ce52.0202120116.463b79d9@posting.google.com>


Hi,

DB version: 8.1.6: I have a package that populates a simple PL/SQL table declared like:

TYPE MyType IS TABLE OF varchar2(10) INDEX BY BINARY_INTEGER;                  

MyTable MyType;

The table is populated via a cursor. My question is, what is the fastest performing way of locating a row in the table based on a supplied varchar2 value? Do I have to loop through each row of the table performing a match as in the following:

 	  for i in 1..MyTable.Count loop
	  	  vValue := MyTable(i);
	  	  if vValue = pValue then
		  	 vResult := 'Y';
		  end if;
	  end loop;

or is there a quicker way?

Thanks in advance!

Rod Received on Tue Feb 12 2002 - 03:16:45 CST

Original text of this message

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