Subject | FOR SELECT... CURSOR? |
---|---|
Author | Rony Cesana |
Post date | 2006-03-03T15:02:39Z |
Hi everybody...
I have just a little question...
Is there a considerable difference between these two ways to update a table
in a stored proc?
1)
FOR
SELECT APrimaryKeyField
FROM ATable
WHERE SomeCondition
INTO :AVariable
DO
BEGIN
/* Some Stuff... */
UPDATE ATable
SET SomeField = SomeValue
WHERE APrimaryKeyField = :AVariable;
END
2)
FOR
SELECT Whatever
FROM ATable
WHERE SomeCondition
INTO :SomeDummyVar
AS CURSOR SomeCursor
DO
BEGIN
/* Some Stuff... */
UPDATE ATable
SET SomeField = SomeValue
WHERE CURRENT OF SomeCursor
END
At first glance I'd have thought the second way is the best, but I wonder
what the group's opinion is...
Cheers,
Rony
I have just a little question...
Is there a considerable difference between these two ways to update a table
in a stored proc?
1)
FOR
SELECT APrimaryKeyField
FROM ATable
WHERE SomeCondition
INTO :AVariable
DO
BEGIN
/* Some Stuff... */
UPDATE ATable
SET SomeField = SomeValue
WHERE APrimaryKeyField = :AVariable;
END
2)
FOR
SELECT Whatever
FROM ATable
WHERE SomeCondition
INTO :SomeDummyVar
AS CURSOR SomeCursor
DO
BEGIN
/* Some Stuff... */
UPDATE ATable
SET SomeField = SomeValue
WHERE CURRENT OF SomeCursor
END
At first glance I'd have thought the second way is the best, but I wonder
what the group's opinion is...
Cheers,
Rony