This is my code:
amount INTEGER;
amount := select count(*) from moneyTable;
I'm getting the following error:
ERROR: syntax error at or near "select"
Can someone help me out.
This is my code:
amount INTEGER;
amount := select count(*) from moneyTable;
I'm getting the following error:
ERROR: syntax error at or near "select"
Can someone help me out.
From the fine manual:
An assignment of a value to a PL/pgSQL variable is written as:
variable { := | = } expression;
but select ... isn't an expression. If you want to assign values from a SELECT to variables, you want to use INTO:
select count(*) into amount from moneyTable;
-- ^^^^^^^^^^^