Written by

IT Officer, Cellular Pathology at Calderdale and Huddersfield NHS Foundation Trust
Question Robert Steed · Sep 22, 2022

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

Comments

David Hockenbroch · Sep 22, 2022

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.

0
Robert Steed  Sep 22, 2022 to David Hockenbroch

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.

0
David Hockenbroch  Sep 22, 2022 to Robert Steed

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

0
Robert Steed  Sep 22, 2022 to David Hockenbroch

Yes I did a search and replace. Cheers!

0