Hi,

I think it would be best to use a simple example to explain my problem. The table below needs to become compressed into to distinct line items
Customer_No Hair SP_Code Gender Age Colour Weight
1 blonde 123 M null null null
1 blonde 123 null 23 null null
1 blonde 123 null null Green null
1 blonde 123 null null null 98
1 blonde 123 null null null null
1 blonde 123 null null null null
1 blonde 123 null null null null
1 blonde 123 null null null null
2 Blue 444 F null null null
2 Blue 444 null 28 null null
2 Blue 444 null null Pink null
2 Blue 444 null null null 64
2 Blue 444 null null null null
2 Blue 444 null null null null
2 Blue 444 null null null null
2 Blue 444 null null null null

Needs to become

Customer_No Hair SP_Code Gender Age Colour Weight
1 blonde 123 M 23 Green 98
2 blue 444 F 28 Pink 64

I have over 163 000 'customers' and customer_no is not necessarily consecutive. There may not exist a customer 3 for example. ie Customer 1, Customer 2, Customer 4...etc. Is there any way to loop through the procedure and pick up the customer_no that exists in the Customer_no column?

Thank-you very much for your time.


Banner:
Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production