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 -> Function in a WHERE clause

Function in a WHERE clause

From: Shabba <shabba_at_nowhere.com>
Date: Thu, 02 Sep 1999 16:03:27 +0100
Message-ID: <37CE91BE.63FCCDF@nowhere.com>


Can anyone give a definitive answer to the following?

In PL/SQL, a row has to be selected from the database on the condition that a key value matches a parameter which is first converted by another function. Is there any advantage/disadvantage in doing the conversion before the select rather than in the WHERE clause of the SELECT?

i.e. which (if either) of the following code segments would be better?

a)

SELECT rowid
FROM any_table
WHERE key_value = my_func(a_parameter);

b)

a_local_variable := my_func(a_parameter)

SELECT rowid
FROM any_table
WHERE key_value = a_local_variable

If anyone can let me know which is better, with a sensible reason why, I'd be grateful.

Thanks

Sh.

PS This is on Oracle 7.3 for SunOS if it makes a difference. Received on Thu Sep 02 1999 - 10:03:27 CDT

Original text of this message

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