Re: unable to assign value to variable in plpgsql

From: Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>
To: Chirag Mittal <linux(at)seasonstravel(dot)co(dot)in>, pgsql-novice(at)postgresql(dot)org
Subject: Re: unable to assign value to variable in plpgsql
Date: 2014-02-16 16:06:55
Message-ID: 5300E21F.1090903@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 02/16/2014 01:22 PM, Chirag Mittal wrote:
> Hi, I am trying to assign number of row as integer Tried 1 maz int
> :=(SELECT count(col1) FROM table WHERE col1 = quote_literal(in val1));
> Tried 2 EXECUTE 'SELECT count(col1) FROM table WHERE col1 =
> quote_literal(val1) INTO maz'; getting error INTO Regards Chirag
> ------------------------------------------------------------------------
> View this message in context: unable to assign value to variable in
> plpgsql
> <http://postgresql.1045698.n5.nabble.com/unable-to-assign-value-to-variable-in-plpgsql-tp5792281.html>
> Sent from the PostgreSQL - novice mailing list archive
> <http://postgresql.1045698.n5.nabble.com/PostgreSQL-novice-f2132464.html>
> at Nabble.com.

SELECT INTO int count(*) FROM table WHERE col1 = val1;

or

int := (SELECT count(*) FROM table WHERE col1 = val1);

--
Vik

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Martin Steer 2014-02-16 16:25:10 Re: unable to assign value to variable in plpgsql
Previous Message Chirag Mittal 2014-02-16 12:22:28 unable to assign value to variable in plpgsql