Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Comparing two tables with different structure

akshayvpnMay 12 2014 — edited May 13 2014

Hello,

I have two tables with different structure. Basically I wanted to compare values in these two tables where one table returns a single row for 'QUANTITY BREAK'. and other table returns multiple rows for QUANTITY BREAK.

Table A:

PART_NO

QTY_BRK1

QTY_BRK2

QTY_BRK3

QTY_BRK4

PROMO_BRK1

PROMO_BRK2

PROMO_BRK3

PROMO_BRK4

LIST_PRICE_BRK1

LIST_PRICE_BRK2

LIST_PRICE_BRK3

LIST_PRICE_BRK4

Sample Record:

PART_NOQTY_BRK1QTY_BRK2QTY_BRK3QTY_BRK4PROMO_BRK1PROMO_BRK2PROMO_BRK3PROMO_BRK4LIST_PRICE_BRK1LIST_PRICE_BRK2LIST_PRICE_BRK3LIST_PRICE_BRK4
100900099000999000999999990001601601601602000200020002000

Table B:

PART_NO

QUANTITY

PRICE

Sample Record:

PART_NOQUANTITYPRICE
10010.016
100100.016
100250.024
1001000.016
10010000.016

I want to find all the PART_NO's where there is a discrepancy in the Table 1 QTY BREAKS and Table 2 QUANTITY values.
In table A, QTY_BRK values are considered as follows:
QTY_BRK1 = 9000 i.e. 1-9

QTY_BRK2 = 99000 i.e. 10-99

QTY_BRK3 = 999000 i.e. 100-999

QTY_BRK4 = 99999999000 i.e. 1000-100000000

So you can see the discrepancy in above example. Table A gives 4 quantity breaks, but table B gives 5 quantity breaks for the same PART_NO. (an extra qty break of 10-25 is present)

This way I need help in writing a query which will give me all the PART_NOs which are having discrepancy in both tables.

Thanks.

Comments

BluShadow

The error seems to suggest that it can't create a spacial index on the data you're wanting it to because some of the data is outside coordinate bounds.

Are you sure your data is appropriate for a spatial index?

Frank Kulash

Hi,

Is this a problem that only occurs in Spatial?  If so, post it in the Spatail forum:

945410

Thanks i posted in Spatial Forum.

945410

I have millions of records so how to find which data is wrong?

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 10 2014
Added on May 12 2014
4 comments
1,919 views