At 11:12 AM 6/1/2004, Gerard Samuel wrote:
A bit off topic, but lately I've been running into situations, where I have
to know about using cursors with databases, like sql server, ibm db2....
Can anyone point me to online resources that explains (to a practical newbie)



Think of it as a scrollable result set on which you can do row by row processing. I've not worked with SQL Server for sometime, but my dusty copy of "SQL Server 6 Unleashed" (SAMS) advises as follows on pp 186-187:

" ANSI-SQL provides the capability of addressing a set of rows individually, one row at a time, by a cursor. A cursor is a pointer that identifies a specific working row within a set. ...

... Before looking at how to use a cursor, you need to understand what cursors can do for your application. Most SQL operations are set operations: a where clause defines the set of rows to address and the rest of the statement provides definitive instructions on what to do with the rows. "

This NOTE follows:

"NOTE It's extremely difficult to come up with compelling examples ff cursor programming. The problem is that cursors introduce a fantastic performance problem ... and nearly always need to be avoided."

Maybe cursor performance has been improved since then. I suppose the $result we refer to when processing the results of a MySQL query is a cursor as it is possible to reposition within it.

Regards - Miles

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to