Answer the question
In order to leave comments, you need to log in
How to save data to a variable in an UPDATE query in a PostgreSQL function?
As it is correct to save the data in a variable in plpgsql, I try so:
DECLARE
c INTEGER;
UPDATE table SET col = (c := col + 1) WHERE id = 1;
(further variable "c" is used in other queries)
Error:
ERROR: syntax error at or near ":="
Answer the question
In order to leave comments, you need to log in
UPDATE ... returning
www.postgresql.org/docs/9.4/static/sql-update.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question