Ececute procedure on each row
Posted in 2006
Topics: General Discussion
Hi, I have temp table: tmp_outstand acc_nr integer settle_nr integer nat_amount decimal(16,2) s_nat_amount decimal(16,2) Is there any way to execute procedure for each row of this temp table (avoiding CURSOR)? This procedure is quite complicated but in short: It takes as parameters 4 variables (one row from tmp_outstand) e.g. my_procedure(l_acc_nr, l_settle_nr, l_nat_amount, l_s_nat_amount) and it updates other table depending on data from tmp_outstand. Procedure does not return any variable. Thanks in advance for any help, Max
So you currently pass in the row you want to process as part of the call to the procedure In order to process a number of rows with just one call of the procedure you would need to rework the logic of the procedure and change the parameters youc all it with
maxskalski@gmail.com wrote: > Hi, > I have temp table: > > tmp_outstand > acc_nr integer > settle_nr integer > nat_amount decimal(16,2) > s_nat_amount decimal(16,2) > > Is there any way to execute procedure for each row of this temp table > (avoiding CURSOR)? Not without rewriting the procedure to use a cursor to process each row instead of taking the values as arguments. Another option, assuming the procedure is useful as it is, just write a second procedure to loop through the temp table using a cursor and execute the procedure for each row. Art S. Kagel > This procedure is quite complicated but in short: > > It takes as parameters 4 variables (one row from tmp_outstand) > > e.g. my_procedure(l_acc_nr, l_settle_nr, l_nat_amount, l_s_nat_amount) > > and it updates other table depending on data from tmp_outstand. > Procedure does not return any variable. > > Thanks in advance for any help, > Max >