Re: unable to assign value to variable in plpgsql

From: Martin Steer <martinsteer(at)maxi(dot)net(dot)au>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: unable to assign value to variable in plpgsql
Date: 2014-02-16 16:25:10
Message-ID: 20140216162409.GA825@arch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sun, Feb 16, 2014 at 04:22:28AM -0800, 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

select count(*)
into maz
from tablename
where col1 = 'val1';

maz int := count(*) from tablename where col1 = 'val1';

M.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David Johnston 2014-02-16 16:34:37 Re: unable to assign value to variable in plpgsql
Previous Message Vik Fearing 2014-02-16 16:06:55 Re: unable to assign value to variable in plpgsql