sql - insert if not exists

后端 未结 4 1710
别那么骄傲
别那么骄傲 2021-01-13 08:44

I am having trouble with a sql query. I need to insert a row if the same row does not exist already. This is what I have so far:

DECLARE
BEGIN
   FOR FOLDE         


        
4条回答
  •  借酒劲吻你
    2021-01-13 09:15

    DECLARE
        N_COUNTS NUMBER;
    BEGIN
        select count(ID) into N_COUNTS from TABLE_NAME where ID = 1;
        IF N_COUNTS=0 THEN
            INSERT QUERY....
        ELSE
            UPDATE QUERY....
        END IF;
    END;
    

提交回复
热议问题