I was looking to just know how to declare variable in a sql file for a PG db so I just try this :
DO $$
DECLARE
i INT := 0;
BEGIN
WHILE i <= numberUsers
BEGIN
SELECT COUNT(*) FROM "Users";
SET i := i + 1;
END;
END $$;
Now I have this result :
psql:matching.sql:10: ERREUR: « LOOP » manquant à la fin de l'expression SQL
LIGNE 7 : SELECT COUNT(*) FROM "Users";
So it seems to not work.
Kind regards !