How do I declare a variable for use in a PostgreSQL 8.3 query?
In MS SQL Server I can do this:
DECLARE @myvar INT SET @myvar = 5 SELECT * FROM somew
Outside of using pl/pgsql or other pl/* language as suggested, this is the only other possibility I could think of.
begin; select 5::int as var into temp table myvar; select * from somewhere s, myvar v where s.something = v.var; commit;