I want to implement a loop inside a function but I receive this error:
ERROR query has no destination for result data
The code:<
The manual instructs:
Sometimes it is useful to evaluate an expression or
SELECTquery but discard the result, for example when calling a function that has side-effects but no useful result value. To do this in PL/pgSQL, use thePERFORMstatement:PERFORM query;
Unless you assign the result, replace
SELECT 1;
with
PERFORM 1;