In Microsoft SQL Server, to test something like this in the query window:
select * from Users where LastName = @lastname
I can add this bef
Perhaps using the DO instruction to simulate a function. In that way you can declare variables and use them to execute your query!
http://www.postgresql.org/docs/9.4/static/sql-do.html