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 -> Returning DISTINCT rows when SQL *DOES NOT* contain distinct!

Returning DISTINCT rows when SQL *DOES NOT* contain distinct!

From: <vistav20_at_yahoo.com>
Date: 11 May 2005 14:03:00 -0700
Message-ID: <1115845380.389498.48530@g14g2000cwa.googlegroups.com>


Hi,

Is there any way to force the result set to behave as if the SQL contained DISTINCT directive, when the SQL DID NOT actually contain the
"distinct" keyword? I am looking for ideas, so please feel free to
suggest different ways (stored procedures, views, etc etc).

Here is the query in question:

SELECT ID FROM TABLE_A
WHERE (ID in (select id from TABLE_B where code like 'ABC%' and dates between to_date('01-JAN-2003') and to_date('31-MAR-2004'))) AND (ID IN ('123', '456')) I get a result set which contains LOTS of multiple rows for the same object_id, etc.

You might be asking the obvious: why don't I add "distinct" to the SQL. Well, the SQL is coming from an automated too, which builds the SQL based on param you provide, and there is no way to force it to send
"distinct" as part of SQL.

This is what I have control over:

1. specify name of TABLE_A (so it could be a view)
2. field name of "ID" field
3. whatever else I want as part of WHERE clause

thanks
Mark Received on Wed May 11 2005 - 16:03:00 CDT

Original text of this message

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