That''s not very mysterious.  no rows were returned to make an assignment to 
the variable.
I would still use Select personally and test for SqlCode after the select to 
determine if rows were returned.


----- Original Message ----- 
From: <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Tuesday, May 15, 2012 5:00 PM
Subject: [RBASE-L] - Difference between "select into" and "set var"


:I am porting over someone else's old DOS code to the windows version.  When
: I do this, I like to update the syntax.  You know, converting "compute" to
: a "select ... into", etc.  However, I found a difference if you convert a
: "set var" to a "select into", and thought I would mention it so it doesn't
: trip someone else up.
:
: In these 2 examples, the where clause is going to fail:
:
: set var vInteger int = 10
: select hourid into vInteger from hours where client = 'zzzz'
: show var vInteger
: --   The result of this is vInteger remains 10
:
: set var vInteger int = 10
: set var vInteger = hourid from hours where client = 'zzzz'
: show var vInteger
: --  The result of this is vInteger being a NULL
:
: The "set var" code I ran into was run from a declare cursor.  The variable
: was not initialized to null, but it didn't matter with the "set var".  But
: as soon as I replaced it with a "select ... into", I found I have to
: initialize the variable first or else it will retain the last cursor's 
value!    So
: at this point, I'm sticking with the "set var" just to be on the safe 
side.
:
: Karen 


Reply via email to