Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 28th, 2005, 04:15 AM
egidy egidy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 166 egidy User rank is Private First Class (20 - 50 Reputation Level)egidy User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 15 h 49 m 31 sec
Reputation Power: 5
update/delete inside for loop in SP

assuming that I have 'My_table' with metadata:
'pk_record integer
value1 integer
indexed_value1 integer'

and I make in SP the following loop:

for select pk_record, value1, indexed_value1 where indexed_value1>50
into : pk_record, :value1, :indexed_value1
do begin
update my_table
...???
where pk_record=: pk_record;
end


So, how far can I go? Can I update indexed_value1 field, or even pk_record field? Or can I safely update only value1 field. Does FB firstly make some set of selected rows and in for I can do anything, or there exists some things to which I have to pay special care?

Besides - do any incompatibilities exist for this issue between IB and FB?

Thanks in advance.


Reply With Quote
  #2  
Old July 4th, 2005, 09:43 AM
IvanP IvanP is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 12 IvanP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 7 m 37 sec
Reputation Power: 0
If you want to update only one, current record, there should not be any problems. You can use cursor for it:


CREATE PROCEDURE ... AS
BEGIN ...
FOR SELECT x,y,z
FROM tab
INTO :a, :b, :c
AS CURSOR cur
DO BEGIN
...
UPDATE tab SET ... WHERE CURRENT OF cur;
...
END
END

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > update/delete inside for loop in SP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT