That brings up an interesting question.  Is it better programming to include
spaces around anything with parens?  For instance is it better to use: IN (
.var1, .var2, .vetc ) instead of IN (.var1, .var2, .vetc) ?

Readability is probably better but does the left paren bumping up against
the dotted or ampersanded variable make a difference?

Alway looking to improve my programming skills.

Thanks -- Mike Ramsour

-----Original Message-----
From: Bill Downall [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 10:05 AM
To: [email protected]
Subject: [RBG7-L] - Re: In clause of where statement


Actually, R:Base only gets confused when the left-parenthesis is
adjacent to the ampersand.  R:Base does not get confused this way:

 SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN ( &vyears )

I prefer that for readability, to having the parens embedded within the
variable.

Bill

Lawrence Lustig wrote:
> 
> SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN (&vyears) 
> 
> which would substitute the string directly into the SQL statement. 
> Unfortunately, this syntax has always confused the R:Base expression
parser and
> will generate an error.  The following, however, should work:
> 
> SET VAR vYears = '(' + .vYears + ')'
> SELECT SUM(quantity) INTO vtotal FROM table WHERE year IN &vYears
> 

Reply via email to