G'day Steve,

At 23:35 27/09/02 -0700, you wrote:
>J. Stephen Wills wrote:
>
>>I have a situation where, at least f/now, it seems best to CURSOR into one
>>table, then, f/ea record, CURSOR into another table f/matching records.  My
>>problem is managing SQLCODE values.  Is it possible to use something other
>>than ...
>>
>>WHILE SQLCODE <> 100 THEN
>>...
>>ENDWHILE
>>
>>That is, could I set a variable equal to SQLCODE at the appropriate points,
>>such as after a FETCH, and test that variable?


Try this:

LABEL RetryC1
DECLARE c1 CURSOR FOR +
   SELECT  +
   FROM  +
   WHERE +
   ORDER BY
IF SQLCODE = -708 THEN
    -- CURSOR ALREADY DEFINED
   DROP CURSOR c1
   GOTO RetryC1
ENDIF
OPEN c1

LABEL LBegC1
FETCH c1 INTO +
   v1 IND vi1, +
   v2 IND vi2, +
   v3 IND vi3, +
   v4 IND vi4, +
   v5 IND vi5, +
   v6 IND vi6, +
   v7 IND vi7, +
   v8 IND vi8, +
   v9 IND vi9, +
   v10 IND vi10, +
   v11 IND vi11, +
   v12 IND vi12, +
   v13 IND vi13, +
   v14 IND vi14
IF SQLCODE = 100 THEN
   GOTO LEndC1
ENDIF

LABEL RetryC2
DECLARE c2 CURSOR FOR +
   SELECT  +
   FROM  +
   WHERE +
   ORDER BY
IF SQLCODE = -708 THEN
    -- CURSOR ALREADY DEFINED
   DROP CURSOR c2
   GOTO RetryC2
ENDIF
OPEN c2

LABEL LBegC2
FETCH c2 INTO +
   v1 IND vi21, +
   v2 IND vi22, +
   v3 IND vi23, +
   v4 IND vi24, +
   v5 IND vi25, +
   v6 IND vi26, +
   v7 IND vi27, +
   v8 IND vi28, +
   v9 IND vi29, +
   v10 IND vi30, +
   v11 IND vi31, +
   v12 IND vi32, +
   v13 IND vi33, +
   v14 IND vi34
IF SQLCODE = 100 THEN
   GOTO LEndC2
ENDIF
-- Insert code here

GOTO LBegC2

LABEL LEndC2
DROP CURSOR c2


GOTO LBegC1

LABEL LEndC1
DROP CURSOR c1

Warmest regards,


Tom Grimshaw
coy:    Just For You Software
tel:    612 9552 3311
fax:    612 9566 2164
mobile: 0414 675 903

post:   PO Box 470  Glebe  NSW  2037  Australia
street: 3/66 Wentworth Park Rd  Glebe  NSW  2037

email:  [EMAIL PROTECTED]
web: www.just4usoftware.com.au

"... the control of impulse -- is the first principle of civilization."-- 
Will Durant,
Pulitzer Prize winning philosopher, writer and historian

the most needed product in the world can be found at
www.thewaytohappiness.org

This email and any files transmitted with it are confidential to the 
intended recipient and may be privileged. If you have received this email 
inadvertently or you are not the intended recipient, you may not 
disseminate, distribute, copy or in any way rely on it. Further, you should 
notify the sender immediately and delete the email from your computer. 
Whilst we have taken precautions to alert us to the presence of computer 
viruses, we cannot guarantee that this email and any files transmitted with 
it are free from such viruses.

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to