Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> SQL join question
I am using Oracle 9i Release 2 and I am trying to pass a ref cursor
with results back to a Java program. The tables look like the
following:
Product Table
Product_id Name
--------------------------------------------------
1 Large Green Shirt 2 Green Socks 3 Black Pants
Keyword Table
Name
The query like the following
SELECT DISTINCT p.product_id
FROM product p, keyword k
WHERE upper(p.name) like '%' || k.keyword || '%'
returns records 1 and 2 above, but I only want 1 since that is the only record with both green AND shirt in it. Is there a way to get the results I want in one SQL statement or do I have to do it with dynamic SQL instead? Thanks again for any help you can provide.
Kevin Mahoney Received on Thu Oct 24 2002 - 10:51:08 CDT