Cursor.Recordcount

Bart Pietercil bart.pietercil at cognosis.be
Mon Feb 2 06:35:29 CST 2009


On 02 Feb 2009, at 12:08, Ruslan Zasukhin wrote:

> On 2/2/09 12:37 PM, "Bart Pietercil" <bart.pietercil at cognosis.be>  
> wrote:
>
> Hi Bart,
>
>> that is what I mean. Is this because doing a curs.recordcount (in the
>> api) equals doing the select count(....) ?
>> So there is nothing to gain ? There is no cursor property that  
>> already
>> has the cursorcount ?
>
> For SPs no such property.
>
> I have not catch what problem with that exception?
>
> It is normal to get cursor and try do fetch
> If empty cursor then record will not be fetched

By itself not really a problem (I can catch this by doing a select  
count()...)
The problem is that in my sp I have let's say 4 places where I need to  
build a cursor that will be looped

create sp

begin

1) makecursor
open cursor
firstrecord
loop
...
end loop

2) makecursor
open cursor
firstrecord
loop
...
end loop

3) makecursor
open cursor
firstrecord
loop
...
end loop

  4) makecursor
open cursor
firstrecord
loop
...
end loop

exception
  when 56503 then.....
end


---------


now if firstrecord in 1) has an empty cursor the proc will jump to the  
exception while I still want 2,3,4 being executed
So the lesson is this: only open 1 cursor within a begin end block, or  
prevent the exception from  happening by doing a curs.recordcount .
Doing a recordcount before building the cursor implies doing the  
select 2 times.

Bart










More information about the Valentina mailing list