using UNION to select out duplicate records
I have a question regarding the use of UNION. I am selecting
data from four schemas into one cursor C1. Between these
individual schemas there are duplicate records. As per the code
below I am able to select unique records and avoid duplicate
records in the Cursor. However, I am getting duplicate fields
within two or three records since UNION only eliminates
duplicate records. I really need to make sure I don't have
duplicate records and duplicate fields. I am putting this data
in a data warehouse and can't have duplicate fields or records.
Any advice is appreciated in advance.
Thanks
-Pat
PS: specifically I am getting duplicate pcode fields that have
unique pdesc, which in turn classify them as unique records.
CURSOR C1
IS
SELECT PCODE, PDESC FROM gpcomp1.gppcat
UNION
SELECT PCODE, PDESC FROM gpcomp2.gppcat
UNION
SELECT PCODE, PDESC FROM gpcomp3.gppcat
UNION
SELECT PCODE, PDESC FROM gpcomp4.gppcat;