I don't think there is any question.

A smart select statement always tends to be a better solution.

The one instance where I'd definitly prefer a procedure over a select is
when the select contains Oracle's tree-walk method (i.e. connect by prior...
start with)

Regards
JL

-----Original Message-----
Sent: Tuesday, February 20, 2001 12:31 PM
To: Multiple recipients of list ORACLE-L


Hi Gurus !

I'm going to some tables with huge amount of records. There are references
between these tables. The
question is:
Does it worth creating a procedure with several small selects or is it
faster to use one select with
joins?

For example:
CUSTOMER(CUST_ID);
CONTRACT(CONTR_ID,CUST_ID);
CONTRACT_ITEM(CONTR_I_ID,CONTR_ID,PHONE_NUM_ID);
PHONE_NUMBER(PHONE_NUM_ID,PHONE_NUM);

I have the PHONE_NUM and I need the CUST_ID.

Which Faster?
SELECT CUST_ID from PHONE_NUM,CONTRACT_ITEM,CONTRACT,CUSTOMER where ....
[JOINS] and
PHONE_NUM=searchedone

or In procedure or function

select phone_num_id into Variable from phone where phone_num=searchedone;
select contract_id into Variable2 from contract_item where
phone_num_id=Variable;
select cust_id into Variable from contract where contr_id=Variable2;



Thanks in advance.
Gyula

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Andor Gyula
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Johan Locke@i-Commerce Services
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to