The select sum is returning one number the select into is probably returning 
multiple numbers.  If you trace the commands, it will tell yoj the issue.

Gary


Sent from my Samsung Epic™ 4G Touch

-------- Original message --------
Subject: [RBASE-L] - Re: Difference between "select into" and "set var" 
From: [email protected] 
To: [email protected] 
CC:  

Good idea, to use the indicator variable.  I never use the
"set var" myself, always prefer the "select into", but it's good
to know that if you're re-doing old code you have to account
for the differences.   And a reminder of how important it is if
you use "select into" you need to either initialize or use an
indicator.

I know Mike said it makes sense that it works this way, but
if in my example I said something like this:

     select sum(number) into vsum from hours where client = 'zzz'

and the where clause fails, it does correctly return a '0' rather than
erroring out and retaining a previous sum.  But a simple

     select number into vsum from hours where client = 'zzz'

will throw an error and retain a previous number.  It doesn't make
sense to me that the 2 act differently.

Karen

In a message dated 5/15/2012 6:57:51 PM Central Daylight Time, 
[email protected] writes: 
I too like the SELECT ... INTO ... option
but I would include INDICATOR variables to test for NULL values.

Reply via email to