You can use the same indicator var for all variables; the results would
be useless but it would prevent error messages when reading null values
into a variable. You could then test specific variables for nullness.
SELECT vvar1 INDICATOR vind1, ...vvarn INDICATOR vind1
However, you can assign a specific indicator variable to a (or more, or
all) variable(s) that you want to test for being null. Then test the
specific ind var for -1.
SELECT vvar1 INDICATOR vind1, ... vvarx INDICATOR vindx,...vvarn
INDICATOR vind1
I'm not sure (at this time in the morning) of the pros & cons of testing
the variable for null vs testing the ind var for -1.
I s'pose testing the ind var for -1 is more definitive and foolproof
than testing the variable for null because of SET NULL ON/OFF and SET
NULL commands.
And, at some time in the future, use of indicator vars might be
required, so there'd be less code to crawl through and fix.
Doug
On 2/18/2013 1:09 AM, Bruce Chitiea wrote:
Shouldn't INDICATOR variables be assigned on a per-variable basis?
SELECT vvar1 INDICATOR vind1, ... vvarn INDICATOR vindn
-------- Original Message --------
Subject: [RBASE-L] - RE: Variable in Cursor
From: Kayza Kleinman <[email protected]
<mailto:[email protected]>>
Date: Sun, February 17, 2013 3:59 pm
To: [email protected] <mailto:[email protected]> (RBASE-L Mailing
List)
This is the relevant code:
declare inRows cursor for +
select Clientid,LASTNAME,FSTNAME,m_i_,MaidenName from CCClientsStage2
OPEN inRows
FETCH inRows into vClientid, vLastname, vFstname, vMI, vMaidenName +
indicator vIndicator
.
.
.
set var vFullName = .vLASTNAME+ ',' & .vFSTNAME& .vMI
set var vMainID = clientid from maininfo where +
tot_name = .vFullname
Tot_Name is a field that concatenates Lastname, Fstname and MI. I
had originally tried the comparison using each variable to each
field. Lastname and Fstaname always have a value. MI is often
blank. In the concatenated field, I just see nothing when there is
a blank in MI, but in the variable I see -0-
-----Original Message-----
From: [email protected] <mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Buddy
Sent: Sunday, February 17, 2013 4:28 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Variable in Cursor
Kayza
How are you comparing the null value. Also make sure you are using
the indicator when selecting values from the column
FETCH c1 INTO varName INDIC ivarName ....
IF varName IS NULL THEN
Do something here
ENDIF
You could also test for NULL
IF ivarName = -1 THEN
Do something here because varName IS NULL
ENDIF
Hope this helps.
Buddy
-----Original Message-----
From: [email protected] <mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Kayza Kleinman
Sent: Sunday, February 17, 2013 3:33 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Variable in Cursor
I have a cursor set up and I'm comparing the values in the cursor
to values in a different table. The problem is that when I pull
the values in the cursor into variables, if the value in the
column is null, the value of the variable shows up as a literal
-0-. This is a problem because the when I do a comparison to the
main table, it doesn't work. When there is a value it does work.
Any ideas?
Kayza Kleinman
CIO &
Director, Nonprofit Helpdesk
Jewish Community Council of Greater Coney Island, Inc
3001 West 37th Street
Brooklyn NY 11224
718 449-5000 x 2266
fax 718 946-8240
http://kayzasblog.nphd.org/
www.jccgci.org <http://www.jccgci.org><http://www.jccgci.org/>
www.nphd.org <http://www.nphd.org><http://www.nphd.org/>
Helping you do good - better.