Skip to main content

Avoid loading duplicate tuple

  • February 20, 2014
  • 1 reply
  • 6 views

Naveen_Kumar
Forum|alt.badge.img+1
create flex table flexT();

copy flexT from 'path/file1.json' parser fjsonparser();

but if we copy from same json file , i dont want to load this duplicate data.

copy flexT from 'path/file1.json' parser fjsonparser();

can anyone explain, how to discard this duplicate?

Thanks

Regards 
Naveen

1 reply

Glenn_1
  • New Participant
  • May 27, 2014
Copy into a staging table. Merge from staging table into final table, skipping the WHEN MATCHED clause:
MERGE INTO final_table f
  ON staging_table s
  USING (s.id = f.id)
  WHEN NOT MATCHED THEN INSERT(id, ...) VALUES(s.id, ...);