Home > Mobile >  Call a stored procedure with OUT parameter within another stored procedure in SAP HANA
Call a stored procedure with OUT parameter within another stored procedure in SAP HANA

Time:08-03

I am currently trying to send an Email from a stored procedure I have created using the native sys.staticserver_sendemail_dev function.

But both the procedures have OUT parameters declared when I try to invoke the email procedure in my I get an error stating the parameters are not declared.

I wanted to know how to call a stored procedure without parameters inside another stored procedure.

CodePudding user response:

I understood from your question, that you have two stored procedures, where one calls the other and both have out parameters. This is a valid constellation. Please find a minimum example, which works on SAP HANA Cloud:

CREATE OR REPLACE PROCEDURE TEST_INNER (OUT i INTEGER)
AS
BEGIN
    SELECT COUNT(*) INTO i FROM DUMMY;
END;

CREATE OR REPLACE PROCEDURE TEST_OUTER (OUT another_i INTEGER)
AS
BEGIN
    DECLARE outparam INTEGER;
    CALL TEST_INNER(:outparam);
    another_i = :outparam;
END;

CALL TEST_OUTER(?);

If this does not solve your issue, you need to provide more details as well as minimal code snippet similar to the one above to reproduce the issue.

  • Related