This is case is for sybase ase 12.5. No CTE.
suppose I have a a table mytab. I want to go through all rows in this table and do something for each row. One easy solution is cursor like
Declare mycur Cursor For
Select * from mytab For Read Only
Open mycur
Fetch mycur Into ...
While @@sqlstatus = 0
Begin
....
insert into tab2(...)
Fetch mycur Into ...
End
Close mycur
Deallocate Cursor mycur
this solution has bad performance because of cursor.
what's the best solution with best performance?