Unanswered: Did you experienced any problems with cursors
can I secure use cursor in Sybase? Are they some problems I can met... I heard that I must not update table that I have cursor - otherwise I can experience unexpected behaviour... Is it true? Are there any other failures as this?
There are some disadvantages while updating through cursors
1) If there are more number of datas to be updated, performance will be an issue to be considered.
2) There is a chance for hanging of server if more datas are to be updated.
3) Before updating the data through cursors, the table has to be locked. There is a chance that some one else can change the data while the data is updated through cursors (as it is time consuming).
4) Dirty read or update should not happen.
declare myCursor cursor
for select id from TABLE where ....
for read only
declare @id numeric(9,0)
fetch myCursor into @id
while @@sqlstatus = 0
update TABLE set some_column = some_data where id = @id
fetch biz_book into @id
1) is this use of cursor O.K, or should I declare cursor for update? Or is there better solution (temporary/permanent tables walking row by row?)
2) is close cursor and deallocate cursor mandatory or Sybase manage this itself?