hello all,
I have this code, I want the SQL to be created depending on the array. I'm not even sure its possible. Everything is fine for the first record but then it equals 100 for the second one, I know that there are 2 records that should meet this requirement in the db.
numCircuits = 1
OPEN deviceCircuits ;
IF sqlca.sqlcode <> 0 THEN
goto rollitout
END IF
FOR count = 1 TO numDevices - 1
holder = sg_deviceid[count]
FETCH deviceCircuits
INTO :sg_circuitID[count];
IF SQLCA.sqlcode = 100 or SQLCA.sqlcode = -1 THEN
CLOSE deviceCircuits ;
numCircuits --
IF sqlca.sqlcode = -1 THEN
MessageBox
("close:deviceCircuits", "Jonhhny",Stopsign!,OKCancel!)
goto rollitout
END IF
END IF
numCircuits++
NEXT
Here is the cursor definition:
DECLARE deviceCircuits CURSOR FOR
SELECT "t_devices"."circuit_id"
FROM "t_devices"
WHERE "t_devices"."device_id" = :sg_deviceid[count] ;
Any suggestions??
Thanks
I have this code, I want the SQL to be created depending on the array. I'm not even sure its possible. Everything is fine for the first record but then it equals 100 for the second one, I know that there are 2 records that should meet this requirement in the db.
numCircuits = 1
OPEN deviceCircuits ;
IF sqlca.sqlcode <> 0 THEN
goto rollitout
END IF
FOR count = 1 TO numDevices - 1
holder = sg_deviceid[count]
FETCH deviceCircuits
INTO :sg_circuitID[count];
IF SQLCA.sqlcode = 100 or SQLCA.sqlcode = -1 THEN
CLOSE deviceCircuits ;
numCircuits --
IF sqlca.sqlcode = -1 THEN
MessageBox
("close:deviceCircuits", "Jonhhny",Stopsign!,OKCancel!)
goto rollitout
END IF
END IF
numCircuits++
NEXT
Here is the cursor definition:
DECLARE deviceCircuits CURSOR FOR
SELECT "t_devices"."circuit_id"
FROM "t_devices"
WHERE "t_devices"."device_id" = :sg_deviceid[count] ;
Any suggestions??
Thanks