POV-Ray : Newsgroups : povray.off-topic : The Daily WTF [again] : Re: The Daily WTF [again] Server Time
21 Jul 2025 04:05:02 EDT (-0400)
  Re: The Daily WTF [again]  
From: Orchid XP v7
Date: 12 Feb 2008 15:37:32
Message: <47b2038c$1@news.povray.org>
Gail Shaw wrote:

> To quote a friend on SQL central. Cursors are RBAR (Row by agonising row)
> processing

I see. I think...

> SQL's a set-based language. It's supposed to process datasets, not
> individual rows.

Agreed.

> Here's a cursor syntax in T-SQL. My oracle's way too rusty
> for me to attempt to do the same in pl-sql.

I probably wouldn't recognise it if you did. *I* haven't done PL/SQL in 
ages either...

> DECLARE curSomething CURSOR FOR
> SELECT somecolumn FROM SomeTable
> 
> FETCH NEXT FROM curSomething INTO @AVariable
> 
> WHILE @@FETCH_STATUS = 0 -- there are rows in the cursor
> BEGIN
>   -- Do something with the variable @AVariable
>   FETCH NEXT FROM curSomething INTO @AVariable
> END

Right. So is it that cursors are inherantly evil? Or just that people 
tend to misuse them to do row-based processing when they could and 
should do set-based?

I was under the vague impression that a cursor is a thing that allows 
you to, say, show 1 page of results, and then fetch the next page a bit 
later...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.