Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Replacing a subselect with Collections
fmarchioni_at_libero.it wrote:
> Hi all oracle users,
> I have a cursor which fetches a few thousand records.
> Inside it I have a subselect which is used for decoding one field.
>
>
> CURSOR snap_crs IS
> SELECT decode (snap.id, 1,
> (select code_ptr from anag_ptr where desc_ptr = snap.ptr_a),
>
> (select code_ptr from anag_ptr where desc_ptr = snap.ptr_b)
> ),
> ..... other fields....
>
>
> My question is: since * anag_ptr * is a static table (doesn't ever
> change),
> is it worthy to replace the subselect with values taken from a
> Collection ?
>
> Having a Java background I would use an Hashtable to insert couples
> (code_ptr,desc_ptr)...but what about pl/sql ? can I do the same ?
>
> Thanks a lot
> Francesco
Is there a specific performance issue you are trying to address or is this just for academic interest? My suggestion ... try it ... benchmark it.
But be very careful about statements like "doesn't ever change." I have seen more than a few Java coders fileted by that statement.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Wed Feb 23 2005 - 11:27:35 CST