I'm trying to do an upsert in a table with the fields of another table. I try to use the ON CONFLICT in the below code, but it gives me always this error:
"Error SQL [42601]: ERROR: syntax error at or near "from" Posizione: 926
If I remove the from orchestrate orchestrate it gives me this exception :
Error SQL [42P01]: ERROR: missing FROM-clause entry for table "orchestrate" Posizione: 334
can somebody help me?
insert into ro_banche (id_banca,code_abi, code_fisc, desc_banca, desc_banca_rid, data_attivaz, data_cessaz, code_abi_nuovo, code_abi_trasf, code_abi_cor, code_abi_nocor, code_abi_giro, flag_tipo_ades, code_tipo_istituto, data_modifica, utente_modifica)
select * from orchestrate
ON CONFLICT (code_abi) DO
update set code_fisc = orchestrate.code_fisc, desc_banca = orchestrate.desc_banca, desc_banca_rid = orchestrate.desc_banca_rid, data_attivaz = orchestrate.data_attivaz, data_cessaz = orchestrate.data_cessaz, code_abi_nuovo = orchestrate.code_abi_nuovo, code_abi_trasf = orchestrate.code_abi_trasf, code_abi_cor = orchestrate.code_abi_cor, code_abi_nocor = orchestrate.code_abi_nocor, code_abi_giro = orchestrate.code_abi_giro, flag_tipo_ades = orchestrate.flag_tipo_ades, code_tipo_istituto = orchestrate.code_tipo_istituto, data_modifica = orchestrate.data_modifica, utente_modifica = orchestrate.utente_modifica
from orchestrate orchestrate
where (ro.code_abi = orchestrate.code_abi);