Razzak:  If I remember correctly, in the past you could define a permanent view
that references a variable and by putting the variable in parenthesis the view 
would
be defined using the variable reference, rather than the variable's actual 
value.  
I haven't tried that lately, but is that still a valid reason for using 
parenthesis?

Such as:   CREATE VIEW viewname AS SELECT.... WHERE colname = (.vDate)

Otherwise if the vDate was not in parenthesis at the time you create the view, 
and
the variable had a variable, the view would have:  WHERE colname = 01/01/2014

Karen

 

 

 

-----Original Message-----
From: A. Razzak Memon <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Fri, Mar 21, 2014 2:07 pm
Subject: [RBASE-L] - Using Parentheses (was Re: Thanks to someone for the code!)


At 02:19 PM 3/21/2014, Alastair Burr wrote:

>Do I remember something about defaulting to TEXT for some reason and
>the parens forced an integer?


Alastair,

Putting parentheses is helpful when comparing to a NULL value.

Here's an practical exercise that you can try to understand the difference.

CONNECT RRBYW18
SET VAR v1 INTEGER = NULL
BROWSE ALL FROM Customer WHERE CustID = .v1

Notice the -ERROR- Missing right side of comparison. (2295)

Now try the following:

BROWSE ALL FROM Customer WHERE CustID = (.v1)

This time you will get the correct message as follows:

<WARNING> No rows exist or satisfy the specified clause. (2059)


In addition, related to using parentheses ...

R:BASE optimizer compares all the factors and selects the "best" index.

To force the R:BASE optimizer to use a particular index, make other
index columns in the WHERE clause compare to expression by putting
parentheses around the comparison value.

For example, putting parentheses around the variable var1 compares
indexcol1 to an expression; indexcol2 is used by the R:BASE optimizer
as the indexed column.

WHERE indexcol1 = (.var1) AND indexcol2 = .var2

That is your tip of the day!

Very Best R:egards,

Razzak

www.rbase.com
www.facebook.com/rbase
-- 
31 years of continuous innovation!
16 Years of R:BASE Technologies, Inc. making R:BASE what it is today!
-- 



 

Reply via email to