I have a stored procedure in HANA that inserts a result set into a variable. However, sometimes, the result set will come up empty.
For example
select dollaramount into variable
from dummy
where x=material;
In some cases, the material won't be in the table, resulting in an empty result.
When this happens, HANA errors out with:
Could not execute 'call zfcc.Z_WEEKS_OF_SUPPLY' in 2.867 seconds .
SAP DBTech JDBC: [1299]: no data found: [1299] "ZFCC"."Z_WEEKS_OF_SUPPLY": line 64 col 4 (at pos 1707): [1299] (range 3) no data found exception
I know I can use an Exit Handler (DECLARE EXIT HANDLER FOR SQL_ERROR_CODE 1299), but I don't want to stop the procedure. I want the variable to be set to a 0 if there is no result.
Any ideas how I can make this happen? Thanks in advance.