Martin Steer wrote
> 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.
Note that if val1 is a variable you do not use quotes. Only when it is a
literal/constant. Using quotes makes it into a literal/constant.
David J.
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/unable-to-assign-value-to-variable-in-plpgsql-tp5792281p5792299.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.