agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Rob Sargent <robjsargent@gmail.com>
To: anand086 <anand086@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Using bind variable within BEGIN END
Date: Thu, 1 Jun 2017 18:59:50 -0600
Message-ID: <D47BEC9D-FD8F-48EA-BC67-BAD5A7A18779@gmail.com> (raw)
In-Reply-To: <1496363048908-5964384.post@n3.nabble.com>
References: <1496363048908-5964384.post@n3.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
I think you'll need to show your code not the error. Postgres version is a good idea. What application stack are you using or is this raw jdbc?
> On Jun 1, 2017, at 6:24 PM, anand086 <anand086@gmail.com> wrote:
>
> Hi,
>
> I am quite new to postgresql and working with application team to migrate to
> postgresql from oracle.
>
> When we are trying to use bind variable within BEGIN/END code block, it
> fails with
>
> Caused by: java.sql.SQLException: The column index is out of range: 1,
> number of columns: 0. Query: DO $do$ DECLARE rowcount int; BEGIN LOOP INSERT
> INTO temp_resolution ( SELECT s.from_entity_id,r.source_entity_id FROM
> temp_resolution as s JOIN temp_resolution as t ON (s.transfer_to_id =
> t.from_entity_id) LEFT OUTER JOIN relates as r ON ( s.transfer_to_id =
> r.target_entity_id AND r.relation_type_id = ? ) LEFT OUTER JOIN attributes
> as a ON ( r.source_entity_id = a.entity_id AND a.attribute_type_id = ? )
> WHERE a.attribute_value::numeric <= 10 OR a.attribute_value::numeric = 99 )
> ON CONFLICT(from_entity_id) DO UPDATE SET transfer_to_id =
> excluded.source_entity_id;GET DIAGNOSTICS rowcount = ROW_COUNT; EXIT WHEN
> rowcount = 0; END LOOP ; END $do$; Parameters: [3, 367]
>
>
> Received the same error while calling a function within BEGIN END code.
>
> What is the correct way to use bind variables in postgresql?
>
>
>
>
>
>
> --
> View this message in context: http://www.postgresql-archive.org/Using-bind-variable-within-BEGIN-END-tp5964384.html
> Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (9+ messages) latest in thread
Message-ID: <D47BEC9D-FD8F-48EA-BC67-BAD5A7A18779@gmail.com>
Permalink: ../D47BEC9D-FD8F-48EA-BC67-BAD5A7A18779@gmail.com/
Also on: postgresql.org/message-id/D47BEC9D-FD8F-48EA-BC67-BAD5A7A18779@gmail.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: robjsargent@gmail.com, anand086@gmail.com
Subject: Re: Using bind variable within BEGIN END
In-Reply-To: <D47BEC9D-FD8F-48EA-BC67-BAD5A7A18779@gmail.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