Hi All
db2 V 8.1.3 Windows
I have an application which processes some rows using an SP.There are 2
approaches to this issue.
1) I can call the SP once and pass all the rows together as CLOB.(Rows and
columns will be separated using special characters,say Rows by '~' and
Columns by'!').Inside the SP I can divide the rows one by one using a
loop.For each row I can use another while loop which will differentiate
the columns and assign it to some local variables.These variables may or
may not be passed in to another procedure based on some conditions.In this
case the loop will run (no. of rows* no. of columns) time.Also overhead of
using functions like POSSTR,SUBSTR etc is there.
2) Call the SP for each row and using a while loop break the columns and
assign them to variables.Rest of the functionality is same.
Now the simple question is ...which method is better...
Calling an SP one time and looping (rows*columns)inside it OR calling an
SP 'rows' times and looping inside it 'columns' time.
TIA
Praveen
--CELKO-- - 11 Feb 2006 19:37 GMT
Why not put the data in a query that works on a table, instead of using
either of these procedual approaches? We do not use loops in a
declarative language.
Since you did not bother to post code or DDL, nobody can help you
figure out how to do this in a set-oriented fashion.
Knut Stolze - 13 Feb 2006 18:49 GMT
> Hi All
> db2 V 8.1.3 Windows
[quoted text clipped - 13 lines]
>
> Now the simple question is ...which method is better...
It depends.
> Calling an SP one time and looping (rows*columns)inside it OR calling an
> SP 'rows' times and looping inside it 'columns' time.
The first question is what kind of functionality do you want to implement
where this logic would be used.

Signature
Knut Stolze
DB2 Information Integration Development
IBM Germany