Y
Y
ya_yshel_rabotati_v_teleg2020-10-25 18:24:19
PostgreSQL
ya_yshel_rabotati_v_teleg, 2020-10-25 18:24:19

How to overcome the error cursor "" is not positioned on a row?

I create a cursor

OPEN curs1 FOR SELECT * FROM leads_client WHERE status = 0;
UPDATE leads_client SET status = 1 WHERE CURRENT OF curs1;

And I try to update it, as a result I get an error
: Kernel error: ERROR: cursor "" is not positioned on a row;

Moreover, if you comment out the update line and get the data, then the lines in the cursor are:
loop
        fetch curs1 into r;
        if(r.id is nOT NULL) THEN 
            id := r.id;
            return next;
        END IF;
        if not(found) then exit; end if;
    end loop;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question