Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL Help
David Fitzjarrell wrote:
> google_at_earthlink.net (Googles) wrote in message news:<a92dd22c.0410181151.1a30a9e8_at_posting.google.com>...
>
>>Need help with this statement. It hangs in SQL*Plus. There is an >>outer join between invoice_header table and ship_addr table. >>SELECT invoice_detail.prod_id, invoice_detail.quantity, >>product.description, ship_addr.country AS stcountry >> FROM invoice_header, invoice_detail, ship_addr, product >> WHERE invoice_header.inv_id IN ('2002780','2002781') AND >> invoice_header.cust_id = ship_addr.cust_id(+) AND >> invoice_header.ship_id = ship_addr.ship_id(+) AND >> invoice_header.inv_id = invoice_detail.inv_id AND >> invoice_detail.prod_id = product.prod_id >>Why did the above statement hang? >> >>fyi... These 2 statements below work >>1) When only one inv_id is in the condition >>SELECT invoice_detail.prod_id, invoice_detail.quantity, >>product.description, ship_addr.country AS stcountry >> FROM invoice_header, invoice_detail, ship_addr, product >> WHERE invoice_header.inv_id IN ('2002780') AND >> invoice_header.cust_id = ship_addr.cust_id(+) AND >> invoice_header.ship_id = ship_addr.ship_id(+) AND >> invoice_header.inv_id = invoice_detail.inv_id AND >> invoice_detail.prod_id = product.prod_id >> >>2) When the outer join is taken out >>SELECT invoice_detail.prod_id, invoice_detail.quantity, >>product.description >> FROM invoice_header, invoice_detail, product >> WHERE invoice_header.inv_id IN ('2002780','2002781') AND >> invoice_header.inv_id = invoice_detail.inv_id AND >> invoice_detail.prod_id = product.prod_id >> >>Thank you.
Oracle now advises to never use scripts such as this one. Please go to
http://www.psoug.org
click on Morgan's Library
click on DBMS_XPLAN
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Mon Oct 18 2004 - 23:34:34 CDT