|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. ![]() |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > update/delete inside for loop in SP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|