Question
Robert Steed · Sep 22

SQLCODE=-52 : Cursor C10 already declared

Hi,

My routine contains embedded SQL including this:

&sql(DECLARE C1 CURSOR FOR

The error "SQLCODE=-52 : Cursor C10 already declared" comes up on compilation in Studio. Does anyone know a way around it please?

Bob

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.7 (Build 721U) Fri Mar 18 2022 22:07:35 EDT
0
0 54
Discussion (4)1
Log in or sign up to continue

If you have multiple cursors anywhere in the class with the same name, that will come up. If it says C10, then you must have two different places where you're doing a "DECLARE C10 CURSOR FOR . . ." and you'll have to rename one of those cursors.

Thanks David. I was declaring cursor C1 in two locations in the routine (no C10 though). I have now renamed one of them to C2 and Studio has compiled it without error.

Great! Just a reminder, make sure you've made that change in all of your other statements for that cursor (open, fetch, close, etc.)

Yes I did a search and replace. Cheers!