agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: James Kitambara <jameskitambara@yahoo.co.uk>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Cc: James Kitambara <jameskitambara@yahoo.co.uk>
Subject: ERROR ON INSERTING USING A CURSOR IN EDB POSTGRESQL
Date: Thu, 9 Dec 2021 10:36:34 +0000 (UTC)
Message-ID: <820139578.307641.1639046195013@mail.yahoo.com> (raw)
References: <820139578.307641.1639046195013.ref@mail.yahoo.com>
ISSUE OF CURSOR ON THE EDB POSTGRESQL
I have the table books2 below with those fields on EDBPostgreSQL.
CREATE TABLE IF NOT EXISTSpublic.books2
(
id integer NOT NULL DEFAULTnextval('books2_id_seq'::regclass),
title character(10) COLLATEpg_catalog."default" NOT NULL,
amount numeric DEFAULT 0,
CONSTRAINT books2_pkey PRIMARY KEY (id)
);
The table is populated with the following data
I want to re-insert the records from ID 8 to 11 for the values of TITLE and AMOUNT as the IDis 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() line15 at CLOSE
SQL state: 34000
HOW CAN I REMOVE THATERROR?. ALSO NOTE THAT I ALWAYS GET THIS ERROR WHEN UPDATING OR INSERTING DATA ONTHE TABLE USING CURSORS.
PLEASE CAN ANYONE ASSIST.
Table Data after running the procedure is described below:
Attachments:
[image/png] 1639045991057blob.jpg (23.8K, ../820139578.307641.1639046195013@mail.yahoo.com/3-1639045991057blob.jpg)
download | view image
[image/png] 1639046039477blob.jpg (31.8K, ../820139578.307641.1639046195013@mail.yahoo.com/4-1639046039477blob.jpg)
download | view image
view thread (6+ messages) latest in thread
Message-ID: <820139578.307641.1639046195013@mail.yahoo.com>
Permalink: ../820139578.307641.1639046195013@mail.yahoo.com/
Also on: postgresql.org/message-id/820139578.307641.1639046195013@mail.yahoo.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jameskitambara@yahoo.co.uk
Subject: Re: ERROR ON INSERTING USING A CURSOR IN EDB POSTGRESQL
In-Reply-To: <820139578.307641.1639046195013@mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox