Re: using a variable as a "macro"

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 18 Dec 2005 11:08:39 -0700
Message-ID: <43a5b3b7$1_at_news.victoria.tc.ca>


cumin (jkilbourne_at_gmail.com) wrote:

: Malcolm Dew-Jones wrote:
: > HansF (News.Hans_at_telus.net) wrote:
: > : On Fri, 16 Dec 2005 07:34:21 -0800, cumin wrote:
: >
: > : > Is there a way to access an environmental variable in sqlplus? A lot of
: > : > the ad hoc queries I run have the phrase
: > : >
: > : > and tty in ('IN','BN','SCD','SBD','SCDF','SBDF','SCDC','SBDC')
: > : >
: > : > and I am too lazy to type that in so much. Is there a way to set and
: > : > retrieve a string variable in sqlplus that will let mr put this string
: > : > into numerous queries? I'd like the vairable to live in the databse,
: > : > but if it needs to be an OS environent variable that's ok too.
: > : >
: > : > Thanks
: >
: > : How about looking up 'substitution variables' in the docco. Or are you
: > : too lazy for that as well?
: >
: > Also, by example
: >
: > select * from table
: > where
: > _at_mycriteria
: > ;
: >
: >
: > uses the file mycriteria.sql

: thank you all; even the "substitution variable" post was helpful (but I
: don't think substitution variables can be made to persist across
: numerous sessions).

: I appreciate your responses to my question.

I didn't notice the "live in the database" part.

Another very recent thread discussed saving lists of values in a table. That thread was concerned with pairs of values, but the same over-all idea can be used here, so just look around for that other thread and use its techniques.

Also, in sql*plus, the value in a column (i.e something in the database) can be selected into a define variable so discussions of 'substitution variables' are more relevant than they at first appear. I can never remember the syntax of that, but it is documented in numerous threads and some sql*plus faqs. It involves the sql*plus COLUMN command. Received on Sun Dec 18 2005 - 19:08:39 CET

Original text of this message