Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Saving SQL code from ABAP
Hi,
I'm making a loop on an array of values with ABAP (functionally equivalent to PL/SQL, it sends SQL commands to the Oracle DBMS) :
LOOP AT array INTO arrayline
SELECT ... FROM table INTO...
WHERE table-key=arrayline-key
ENDLOOP.
It is not efficient ("slow by slow" : many SQL calls), and it can be
summarized with the only nice ABAP feature that I know of :
SELECT ... FROM table INTO...
FOR ALL ENTRIES OF some_array
WHERE table-key = some_array-key.
Seems nice.
BUT when looking at the SQL that ABAP generates and Oracle executes, I see that it IS still a loop, but 5 by 5 (same query fetched many times) :
SELECT ... FROM...
WHERE key = :A1 OR key = :A2 or key = :A3 or key = :A4 or key = :A5 ;
=> Do the gurus there know if I can count on 5 times improvement against the
common slow-by-slow method? ( I cannot really measure here).
Can I hope on another 4 times if I tune the parameters to make it loop 20 by 20?
Do you know of any reason why the ABAP creators have put a limitation on 5 values and not 100 or 10000 ?
Do you know if the FORALL feature of Oracle behaves radically differently?
Thanks in advance!
PS: If you like PL/SQL and must learn ABAP/SAP, be prepared to suffer. I really didn't enjoy it.
-- KrysztofReceived on Tue Oct 24 2006 - 14:02:17 CDT