Parameter for query

From: Robert James <srobertjames(at)gmail(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Parameter for query
Date: 2013-07-17 04:25:38
Message-ID: CAGYyBgi=jsYughrTRzA0F_Jj+fWmgD3f_AGOazqHoQZYg8g+wA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there any way to set a variable or parameter for a query?

I have a long query where a certain variable needs to be easy to
change. I'd like to do something like:

threshold = 10.3

SELECT... WHERE x > $threshold... AND y * 1.3 > $threshold...

Currently, I need to do this in a scripting language. Is there a
straightforward way to do this directly in Postgres?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2013-07-17 04:36:41 Re: Parameter for query
Previous Message Michael Paquier 2013-07-17 01:59:03 Re: Using pg_start_backup() and pg_stop_backup()