i have to check if record exists in table , if there is record then update else insert.Stg_tableId seq name company1 1 aaa yyy1 2 aaa bbbtable Id seq name company1 1 aaa yyy1 2 aaa bbbnow I have another row in staging with sequence 3Stg_tableId seq name company1 1 aaa yyy1 2 aaa bbb1 3 aaa wwwI have to check if this exists in table, if it does not exist only then insert. I cannot use MERGE as it is giving me trigger issues and I tried using if exists(below is my code)If exists(select 1 from stg_table s join table ton s.id=t.id and t.seq=s.seq )beginupdate -----endelse begininsert -----endHow ever, the records are going as updates because it is satisfying the condition. How do i insert in such cases?table Id seq name company1 1 aaa yyy1 2 aaa bbbany help is appreciated
↧