Re: insert ..... returning <column> problem

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Michael Ivanov <ivans(at)logit-ag(dot)de>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: insert ..... returning <column> problem
Date: 2021-06-24 13:14:47
Message-ID: 55a5f85f533342d6b4ae4f518a8a29f1f261ce45.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2021-06-24 at 12:31 +0300, Michael Ivanov wrote:
> I'm trying to insert a record returning column value using the following query:
>
> INSERT INTO t_load (load_id, load_type) VALUES (:id, :typ) returning load_idx INTO :idx
>
> But when I try to prepare the query I'm getting the following error:
>
> PREPARE p1515544c00000001 AS insert into t_load (load_id, load_type) values ($1, $2) returning load_idx into $3]:
> ERROR: syntax error at or near "into" LINE 1: ...ad_id, load_type) values ($1, $2) returning load_idx into $3
> ^
> Why 'into var' is not accepted here?

Are you talking about ECPG?

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thorsten Schöning 2021-06-24 13:24:52 How much data does server side "loread" return?
Previous Message Nicolas Seinlet 2021-06-24 12:53:26 Re: second CTE kills perf