Subject | RE: [IBO] For UPDATE clause? |
---|---|
Author | Norman Dunbar |
Post date | 2002-12-09T09:31:22Z |
Alan,
select ... for update means that (from the sql language reference) :
"Specifies columns listed after the SELECT clause of a DECLARE CURSOR
statement that can be updated using a WHERE CURRENT OF clause"
What this means is that in a stored procedure, you can select all the rows
you wish to update, then update them as necessary.
I've never used it myself in Interbase/Firebird yet, but in Oracle (my day
job) it also puts a row lock on each record selected. If someone else has
one or more of those rows locked already, then my select .. for update will
fail.
Basically, this command allows you to make sure that all the rows you wish
to update are available and unlocked. I'm sure that if Firebrid does it
differently, I'll be corrected :o)
Regards,
Norman.
-------------------------------------
Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar@...
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com
-------------------------------------
-----Original Message-----
From: Alan McDonald [mailto:alan@...]
Sent: Sunday, December 08, 2002 12:00 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] For UPDATE clause?
I see occasionally the clause "FOR UPDATE" in the SQL box. Must ahve missed
reading the explanation for it. Can someone enlighten me?
Alan
This email is intended only for the use of the addressees named above and
may be confidential or legally privileged. If you are not an addressee you
must not read it and must not use any information contained in it, nor copy
it, nor inform any person other than Lynx Financial Systems or the
addressees of its existence or contents. If you have received this email
and are not a named addressee, please delete it and notify the Lynx
Financial Systems IT Department on 0113 2892990.
select ... for update means that (from the sql language reference) :
"Specifies columns listed after the SELECT clause of a DECLARE CURSOR
statement that can be updated using a WHERE CURRENT OF clause"
What this means is that in a stored procedure, you can select all the rows
you wish to update, then update them as necessary.
I've never used it myself in Interbase/Firebird yet, but in Oracle (my day
job) it also puts a row lock on each record selected. If someone else has
one or more of those rows locked already, then my select .. for update will
fail.
Basically, this command allows you to make sure that all the rows you wish
to update are available and unlocked. I'm sure that if Firebrid does it
differently, I'll be corrected :o)
Regards,
Norman.
-------------------------------------
Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar@...
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com
-------------------------------------
-----Original Message-----
From: Alan McDonald [mailto:alan@...]
Sent: Sunday, December 08, 2002 12:00 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] For UPDATE clause?
I see occasionally the clause "FOR UPDATE" in the SQL box. Must ahve missed
reading the explanation for it. Can someone enlighten me?
Alan
This email is intended only for the use of the addressees named above and
may be confidential or legally privileged. If you are not an addressee you
must not read it and must not use any information contained in it, nor copy
it, nor inform any person other than Lynx Financial Systems or the
addressees of its existence or contents. If you have received this email
and are not a named addressee, please delete it and notify the Lynx
Financial Systems IT Department on 0113 2892990.