Re: ERROR ON INSERTING USING A CURSOR IN EDB POSTGRESQL

From: Sandeep Saxena <sandeep(dot)lko(at)gmail(dot)com>
To: James Kitambara <jameskitambara(at)yahoo(dot)co(dot)uk>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: ERROR ON INSERTING USING A CURSOR IN EDB POSTGRESQL
Date: 2021-12-09 10:55:10
Message-ID: CAA3fAREzZF1J5hoBO+YmmVcvTe7Jdd9O3S9Mrk=TzTFXew_dHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Do you have commit inside cursor?

On Thu, Dec 9, 2021 at 4:06 PM James Kitambara <jameskitambara(at)yahoo(dot)co(dot)uk>
wrote:

> *ISSUE OF CURSOR ON THE EDB POSTGRESQL*
>
> I have the table books2 below with those fields on *EDB PostgreSQL.*
>
> CREATE TABLE IF NOT EXISTS public.books2
> (
>
> id integer NOT NULL DEFAULT nextval('books2_id_seq'::regclass),
>
> title character(10) COLLATE pg_catalog."default" NOT NULL,
>
> amount numeric DEFAULT 0,
>
> CONSTRAINT books2_pkey PRIMARY KEY (id)
>
> );
>
>
> The table is populated with the following data
>
> [image: Inline image]
>
>
>
> I want to re-insert the records from ID 8 to 11 for the values of TITLE
> and AMOUNT as the ID is out-increment. To accomplish this I have created
> the procedure named *temp_insert_in_books2()* to do this
>
> The procedure does what I wanted *BUT IT GIVES ME THIS ERROR MESSAGE:*
>
> *ERROR: cursor "book_cur" does not exist*
>
> *CONTEXT: edb-spl function temp_insert_in_books2() line 15 at CLOSE*
>
> *SQL state: 34000*
>
> *HOW CAN I REMOVE THAT ERROR?. ALSO NOTE THAT I ALWAYS GET THIS ERROR WHEN
> UPDATING OR INSERTING DATA ON THE TABLE USING CURSORS.*
>
> *PLEASE CAN ANYONE ASSIST.*
>
>
> Table Data after running the procedure is described below:
>
> [image: Inline image]
>
>
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message James Kitambara 2021-12-10 15:40:41 Re: ERROR ON INSERTING USING A CURSOR IN EDB POSTGRESQL
Previous Message James Kitambara 2021-12-09 10:36:34 ERROR ON INSERTING USING A CURSOR IN EDB POSTGRESQL