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 -> Re: many Union all vs. inserting results to temp table

Re: many Union all vs. inserting results to temp table

From: ianal Vista <ianal_vista_at_hotmail.com>
Date: Thu, 23 Mar 2006 03:05:36 GMT
Message-ID: <Xns978EC215F1158ianalvistahotmailcom@70.169.32.36>


deann15_at_yahoo.com wrote in news:1143081092.564543.290890 @u72g2000cwu.googlegroups.com:

> actually I have a table temp which stores data like this:
>
> aid bid cid txt
> 1 100 900 e
> 1 100 901 f
> 1 200 918 a
> 1 300 915 g
> 1 300 918 a
> 1 300 916 k
> 2 100 901 p
> 2 200 915 j
> 2 200 918 b
>
> aid resides in different bids. I need to write a query to compare
> values from txt column for every aid and cid from source where bid=200
> and every target bids, in this case, with bid = 300 and bid=200 and
> returns conflicting values between source and target for the aid/bid
>
> The query will return something like this:
> aid srcbid cid srcValue targetbid targetValue
> 1 200 900 100 e
> 1 200 901 100 f
> 1 200 915 300 g
> 1 200 916 300 k
> 1 200 918 a 100
> 1 200 918 a 300
> 2 200 901 100 p
> 2 200 915 j 100
> 2 200 915 j 300
> ......
>
> I have one query to compare values between source and target as long
as
> the rows exist in the table, but for non-existent values from source
or
> target, I have to write a query to compare source with every targetid
> then union the results together. but the problem is there can have
many
> targetids, then I will have build the query dynamically and have many
> unions.
>
> what's the alternative to get the correct results? thanks in advance.
>

I've looked at both your posts for 10+ minutes & my brain hurts. I do not understand the problem statement. I would not know the correct results even it I were shown it. My gut says that a PL/SQL solution most likely exists. From what I understand from your 2 posts, I suspect that no SQL only solution will scale.

You're On Your Own. Received on Wed Mar 22 2006 - 21:05:36 CST

Original text of this message

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