Feedback on procedure

Bart Pietercil bart.pietercil at cognosis.be
Mon Sep 15 02:22:05 CDT 2008


Hi Thorsten,

it seems it would have better that I HAD taken some coffee before  
writing this procedure

On 15 Sep 2008, at 00:34, Thorsten Hohage wrote:

> Hi Bart,
>
> while I'm obviously to tired to get deep in your logic, I asked, why
> you're using a cursor for a "single" operation?

banging his head, shouting 'WHY?'
Probably been so busy with cursors I forgot the obvious....

>
>
>
> On 2008-09-14, at 23:28, Bart Pietercil wrote:
>> 		declare myCounter integer;
>> 		declare ListID integer;
>> 		declare cur2 cursor For Select count(recid) from tbl_typelists  
>> where
>> objptr_organisation = OrganisationID and typelistname
>> ='usergroups';			
>> 			
>> 		OPEN cur2;
>> 		fetch first cur2 into myCounter;
>> 		close cur2;
>
>
> a simple
>
> 	set myCounter = Select count(recid) from tbl_typelists where
> objptr_organisation = OrganisationID and typelistname ='usergroups';		
>
> should do it here. Of course I'm not sure, if this is noticeable
> faster, but it's obviously less code so less errors can be made.
>
>
> And as far as I can see, you never close cur3 - this might be ok, if
> SP terminated correctly but can cause issues with cursor alread open
> cur3 if not.
>

correct
>
> If you want to get more details / opinions I need a coffe tomorrow
> morning first ;-)
>
>
>
> regards,
>
> Thorsten Hohage
> -

Thanks




More information about the Valentina mailing list