jeudi 25 juillet 2019

If not exist for insert or update on Oracle

I want to insert a row , if the row does not exists and if it exists, I want to update the row. I am currently using PLSql Oracle. When i want to write a query like this;

IF NOT EXIST (SELECT * FROM TABLE_NAME WHERE ID=1)
   INSERT INTO TABLE_NAME(ID,NAME)VALUES(1,'CAGDAS SANCARBARLAZ')
ELSE
   UPDATE TABLE_NAME SET NAME='UGUR CAN' WHERE ID=1


How can i do that in Oracle Sql ?

Aucun commentaire:

Enregistrer un commentaire