Hi,
I am trying to create a stored procedure in HANA , that calls 2 stored procedures and get the returned tables into 2 local variables.
Then the procedure union these 2 local tables into the one table which is the procedure output.
data volume of each local table is around 20,000 records.
Procedure defintion
CREATE PROCEDURE "SAP_HRF"."DHS_AGGREGATOR" (OUT aggr_output "SAP_HRF"."sap.DHS::DHS1.OUTPUT.TYPE")
language SQLSCRIPT sql security invoker reads sql data as
Begin
--local varibles
declare lt_output_1 "SAP_HRF"."sap.DHS::DHS1.OUTPUT.TYPE";
declare lt_output_2 "SAP_HRF"."sap.DHS::DHS1.OUTPUT.TYPE";
declare lt_action_placeholder "SAP_HRF"."sap.hrf.resources.rule.model::T_SERVICE_ACTIONS_RESULT";
-- rules execution
CALL "SAP_HRF"."sap.DHS::DHS1"( lt_output_1 , lt_action_placeholder );
CALL "SAP_HRF"."sap.DHS::DHS1"( lt_output_2 , lt_action_placeholder );
-- results aggregation
aggr_output =
select * from :lt_output_1
UNION ALL
select * from :lt_output_2;
End;
Procedure output type -
CREATE TYPE "SAP_HRF"."sap.DHS::DHS1.OUTPUT.TYPE" AS TABLE ( "HRF_RESULT_ID" CHAR(32) CS_FIXEDSTRING,
"RULE_ID" CHAR(32) CS_FIXEDSTRING,
"RULE_NAME" NVARCHAR(256) CS_STRING,
"RULE_PACKAGE" NVARCHAR(256) CS_STRING,
"RULE_TEMPLATE_NAME" NVARCHAR(256) CS_STRING,
"RULE_TEMPLATE_PACKAGE" NVARCHAR(256) CS_STRING,
"HEADER" VARCHAR CS_STRING,
"GUID" VARCHAR CS_STRING,
"ROW_ID" CHAR(32) CS_FIXEDSTRING,
"numericInput" DECIMAL(17,
5) CS_FIXED,
"secondNumericInput" DECIMAL(17,
5) CS_FIXED )
When trying to execute the procedure I am getting the following error -
Could not execute 'CALL "SAP_HRF"."DHS_AGGREGATOR"(?)' in 199 ms 727 µs .
[129]: transaction rolled back by an internal error: [129] transaction rolled back by an internal error: exception 71000274: Failed in "" column with the value '2E0717F9512534C7ABD9B1770BB9B23B'
(please check lines: 20)
When running each inner procedure by itself - get no error
When trying to comment out the union and return one of the tables - get no error
Did any one encounter that?
thanks!
Yaron