I have the following statement (Oracle SQL) that I want to realize in Servoy:
insert into table
values (id_1, val_1)
where not exists
(select null from table where id = id_1 and val = val_1);
Basically, it’s the realization of unique constraint…
Of course, I can do a search in the table and if no record is found i can create a new one and insert the values there. This seems a bit complicated, however. Maybe someone experienced out there has a much easier way to do this sort of thing.
Maybe also possible: a unique constaint on the two columns (I’m using MySQL 4.0, don’t know, if it’s possible in that version…) and in case of a constaint violation do nothing (error handling in the method).
Thanks for any suggestions!