Re: Looking info for SCSYNTHETIC CURSOR
- From: "Keith" <keith.wingate@xxxxxxxxxxxxxxxxx>
- Date: 20 Feb 2007 07:42:15 -0800
On Feb 16, 2:53 am, "adisa...@xxxxxxxxx" <adisa...@xxxxxxxxx> wrote:
Hi everybody,
looking for more info refering SCSYBTHETIC CURSOR to use ti in my
store
procedure.
I checked in T-SQL Guide on sybase 12.5.x but I did not fin any
information
Thanks in advance
Regards
Antonio
My only exposure to the term "synthetic cursor" is within a Sybase
ASE context where code like the following is used in lieu of the more
standard cursor declare, fetch, read, etc. Somewhat surprisingly
(for me at least), the synthetic cursor seems to always performs
better than the real deal, in my experience; requires less code, and
uses simpler, more SQL common syntax to achieve
the same end -- if you can use it. You must be able to derive a
single-element, sortable primary key for this to work, and you must be
able to process the rows in that sort order
declare @myKey numeric
select @myKey = min(myKey) from myTable where myKey > isnull(@myKey,
0) /* and.... */
while @myKey is not null
begin -- {
/* Perform record-oriented login on the row referenced by @myKey
*/
/* Get the next row */
select @myKey = min(myKey) from myTable where myKey >
isnull(@myKey,0) /* and.... */
end -- }
'hope that helps,
Keith
.
- References:
- Looking info for SCSYNTHETIC CURSOR
- From: adisabat@xxxxxxxxx
- Looking info for SCSYNTHETIC CURSOR
- Prev by Date: Re: 64 Bit Server and Page Size
- Next by Date: Sybmigrate
- Previous by thread: Re: Looking info for SCSYNTHETIC CURSOR
- Next by thread: Help me solving this problem
- Index(es):