Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Debug procedure throws an exception error

$
0
0

Hello All,

 

I have been asking couple of questions and no responce to any of those. So hoping to get some help this time.

 

Well, I am writing a procedure using cursor and a part of my code is here as follows:

 

CREATE PROCEDURE claims_test()

 

 

LANGUAGE SQLSCRIPT AS        

 

 

matnr_ertrag varchar(18) :=null;

verhw_value decimal(15,4) := 0;

vnthw_value decimal(15,4) := 0;

percent_value decimal(15,4):= 0;

 

CURSOR sofort 

 

FOR select "REFID", "ORGID_WE", "ARTIKEL", "ORGID_ARTIKEL", "HERSTELLER", sum("WERT")as WERT, sum("BZBAS_AW") as BZBAS_AW

  from "SYSTEM"."T01M500_SOFORT"

  GROUP BY "REFID", "ORGID_WE", "ARTIKEL", "ORGID_ARTIKEL", "HERSTELLER" ;

 

BEGIN

 

  FOR cur_row as sofort DO

 

  RESULT_ERTRAG = select "REFID", "LIFNR", "MATNR", "ORGID", "VNTHW", "VERHW" from "SYSTEM"."T01M500_ERTRAG" where  "REFID" = cur_row."REFID";

 

    select "MATNR" into  matnr_ertrag from :RESULT_ERTRAG;

    select  "VNTHW" into  vnthw_value from :RESULT_ERTRAG;

    select "VERHW" into   verhw_value from :RESULT_ERTRAG;

 

I face a problem from the line where the variable being marked red. When I debug and check the code line by line, I see that RESULT_ERTRAG fetches 2 rows. But, when it jumps to the next line i.e select "MATNR" into  matnr_ertrag from :RESULT_ERTRAG; , MATNR  does not have any value inside and debugging stops throwing an exception. My question is whether my representation/select query is appropriate?  If not, please suggest a solution.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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