I am trying to pass a query from oracle to POSTGRESQL and it has not worked for me, how can I do it? the code is the following:
Oracle:
create function updateinsert
create cursor xx
select id
from "CCRs"
where status = 'POR REGULARIZAR'
and id in (221424,188790);
begin
open cursor xx
loop
update ccrs
set status ='ANULADO',
isActive = false,
cancelationDate = now(),
updatedAt= now()
where id = xx.id;
INSERT INTO public.CCRHistories
(status, createdAt, updatedAt, ccrId, userId)
VALUES('ANULADO', now(), now(),xx.id , 2438);
end loop;
end;