Hello,
I would like to do that, "if exists update else insert".
This is my query (executed from a java program), but it's not working and don't know why:
Code:
String queryPostgresql = "if exists(select oid from trabajos where oid = "+ oid +") update trabajos set (uid = "+ uid +", fecha_fin = to_timestamp("+ etime +")) values ("+ uid +", to_timestamp("+ etime +") ELSE insert into trabajos (uid, fecha_fin) values ("+ uid +", to_timestamp("+ etime +") where oid = "+ oid +"";
This i think would work in mysql (maybe the syntax isn't ok).
Any help?
Thanks.