Re: Execute SQL statements with 'context'/predefined variables

From: chester c young <chestercyoung(at)yahoo(dot)com>
To: blay bloo <blaybloo(at)googlemail(dot)com>
Cc: sql pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Execute SQL statements with 'context'/predefined variables
Date: 2007-09-03 21:59:11
Message-ID: 692669.75275.qm@web54306.mail.re2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> I was wondering if it is possible to set the 'context' for running an
> sql command

Oracle has a Context('varname') that returns the value of varname for
the session. to best of my knowledge pg has nothing like this.

> I guess bottom line, is it possible to execute a bunch of SQL
> statements with some predefined variables?

you could use rules to inject you constants as long as you were dealing
with known tables/views; you'd have to rewrite the rules each time the
constants changed; the rules are not session oriented - each sessions
would use the same rule.

(if you have not used pg rules imho you are in for a very pleasant
surprise.)

____________________________________________________________________________________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message PostgreSQL Admin 2007-09-04 00:21:13 Re: Constraints for grouping
Previous Message Richard Broersma Jr 2007-09-03 20:40:06 Re: Constraints for grouping