I have several queries in a query window in pgAdmin, many using the same value(s). Is there a way to declare a variable, myVar to use in query statements?
SELECT * FROM table WHERE user = myVar;
INSERT INTO table(user) VALUES (myVar);
A simple example:
DO $$
DECLARE
myVar VARCHAR := myValue;
BEGIN
INSERT INTO table(user) VALUES (myVar);
END $$;