Multiple Nested Cursors in ESQL/C
Posted in 1994
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL
Help! I just encountered a very bizarre problem in some old code. I'm wondering if any of you can shed some net.light on this situation. Configuration: Informix OnLine - "RSAM Version 5.02.UC1", according to tbstat -p ESQL/C, also version 5.02.UC1 SunOS 4.1.3, Sun 4/280 I have some C code that uses static SQL and nested cursors, thusly: in first file: $declare c1 cursor for select ... into ... from t1 ...; $open c1; $fetch c1; while(sqlca.sqlcode == 0) { $declare c2 cursor for select ... into ... from t2 ...; $open c2; $fetch c2; while(sqlca.sqlcode == 0) { f3(); $fetch c2; } $close c2; $fetch c1; } $close c1; in second file: f3() { $declare c3 cursor for select ... into ... from ...; $open c3; $fetch c3; while(sqlca.sqlcode == 0) { -- do something meaningful with c3 record $fetch c3; } $close c3; } etc., up to six levels of nested cursors. Is this a legal thing to do? I couldn't find any information advising me NOT to do it in the Informix documentation, but it doesn't work. I'm experiencing problems with the c2 loop. It should successfully fetch about 500 rows. The loop fetches successfully once, calls f3, and returns sqlca.sqlcode = 100 at the next fetch of c2. FWIW, this worked like a charm under OnLine 4.00 and ESQL/C 4.00, but bad things are happening to me under 5.02. Any help/workarounds/advice/... would be appreciated. Thanks. ...gwr... -- George Rapp Mail: gwr@metronet.com (home, preferred) - gwr@edsr.eds.com (work) Phone: 214/604-1036 (voice - work) 214/604-1126 (fax) Only dead fish swim with the current.