Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9159

Re: How to iterate over internal table in SQL procedure?

$
0
0

You should avoid row by row processing on HANA when you can.

 

You can use a cursor in this case, the performance is goodish. Here's a code sample copied from another topic:

 

CURSOR c_sosys (vc_zsosy_fr NVARCHAR(5), vc_zsosy_to NVARCHAR(5))

   FOR

     select distinct "ZSOSY" as ZSOSY

     from sapuser."QZGCODE"

     where "ZSOSY" between :vc_zsosy_fr and :vc_zsosy_to;

 

   v_source_system NVARCHAR  (5) := '';

 

 

   FOR sosys_row AS c_sosys(:v_zsosy_fr, :v_zsosy_to) DO

 

     select sosys_row.ZSOSY into v_source_system from DUMMY;

       v_l_val2 := 'Source System : '||:v_source_system;

 

            UPSERT Z_TABLE ...

 

             where oh."ZSOSY" = sosys_row.ZSOSY

          

             CALL PROC_LOG_MSG (:v_l_val2);

 

   END FOR; --- End of Cursor loop c_sosys

 

Cheers,

Fernando


Viewing all articles
Browse latest Browse all 9159

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>