From: hubert depesz lubaczewski <depesz@depesz.com>
To: J.A. <postgresql@world-domination.com.au>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: PL/pgSQL doesn't support variables in queries?
Date: Wed, 3 May 2023 14:31:16 +0200
Message-ID: <ZFJUFK5bDvpSIKFH@depesz.com> (raw)
In-Reply-To: <CALT+_gvfHtF5jqQg+J2suw3hOEh3ZWjZQDB8jJ945o4b1ekyyQ@mail.gmail.com>
References: <CALT+_gvfHtF5jqQg+J2suw3hOEh3ZWjZQDB8jJ945o4b1ekyyQ@mail.gmail.com>
On Wed, May 03, 2023 at 10:25:55PM +1000, J.A. wrote:
> Heya folks :)
>
> ms-sql person here migrating over to pgsql. One of the first thing's I
> noticed with pgsql (or more specifically, PL/pgSQL) is that it doesn't
> support "variables" in a query?
>
> for example, here's some T-SQL:
>
> DECLARE @fkId INTEGER
Sure it does.
There is nothing relating to "@" character, though.
You can easily find examples in docs:
https://www.postgresql.org/docs/current/plpgsql-structure.html
depesz
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: depesz@depesz.com, postgresql@world-domination.com.au
Subject: Re: PL/pgSQL doesn't support variables in queries?
In-Reply-To: <ZFJUFK5bDvpSIKFH@depesz.com>
References: <CALT+_gvfHtF5jqQg+J2suw3hOEh3ZWjZQDB8jJ945o4b1ekyyQ@mail.gmail.com> <ZFJUFK5bDvpSIKFH@depesz.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox