merge statement problem (ora - 30926)
I want to use merge statment instead of the following insert
insert into temp_party(billno,grdt,gramt) select bill_no,vdate,sum(amt) from tran where nvl(crcode,'na') = '50303' and gr_no is not null
and bill_no in(select billno from temp_party) group by bill_no,vdate
this insert statement is working fine and is inserting rows.
THE FOLLOWING MERGE STATMENT FAILS, WITH THE ERROR
"UNABLE TO GET STABLE SET OF ROWS IN THE SOURCE TABLES".
MERGE into temp_partyout A USING(select bill_no,vdate,sum(amt) AMT from
tran where nvl(crcode,'na') = '50303' and gr_no is not null
and bill_no in(select billno from temp_partyout) group by bill_no,vdate) B
ON(A.BILLNO = B.BILL_NO)
WHEN MATCHED THEN UPDATE SET A.GRDT = B.VDATE,A.GRAMT = B.AMT
WHEN NOT MATCHED THEN
CAN ANY BODY PLZ GIVE THE SOLUTION OR CORRECT THE ABOVE MERGE
Most likely table to be merged has multiple rows with same merge-key.
Pablo (Paul) Berzukov
Author of Understanding Database Administration
available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Click Here to Expand Forum to Full Width