declare cnt number;
begin
cnt:=0;
select count(1) into cnt from table where ...;
if cnt>0 then
update table set...
else
insert into table(columns...) values(...)
end if;
end;
begin
cnt:=0;
select count(1) into cnt from table where ...;
if cnt>0 then
update table set...
else
insert into table(columns...) values(...)
end if;
end;
begin
cnt:=0;
select count(1) into cnt from table where ...;
if cnt>0 then
update table set...
else
insert into table(columns...) values(...)
end if;
exception
when others....
end;