Thank you, Razzak,

In theory, I know all that – in practise, it’s good to take a refresher course.

I just had a vague memory, probably back to v2.11, that there was some 
circumstance where R:Base took a text value if the type was not defined and the 
parens forced the type to integer. Maybe it was the other way around or perhaps 
it wasn’t text but another type.

More likely, it’s just my imagination and it’s not important anyhow since 
_everybody_ knows now to ensure R:Base is told explicitly what type is 
required. Besides, it’s so long time ago now that memories play far too many 
tricks.

Regards,
Alastair.



From: A. Razzak Memon 
Sent: Friday, March 21, 2014 7:06 PM
To: RBASE-L Mailing List 
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