cancel
Showing results for 
Search instead for 
Did you mean: 

returning two tables in a function in hana??

Former Member
0 Kudos

hi,

is it possible to return two tables in a function...as we can return two scalar variables in a function in hana?

thanks& regards

sonchita

Accepted Solutions (0)

Answers (1)

Answers (1)

vairma
Advisor
Advisor
0 Kudos

Hi Sonchita,

As of now,we can only return one Table in a function, two or more tables are not yet supported.

You can refer this link [http://help.sap.com/hana/SAP_HANA_SQL_Script_Reference_en.pdf] [Page No. 39].

Just a suggestion, you can use HANA DB procedure to achieve the same above usecase. There you can create one more tables type structures as output.

Hope this helps.

Best Regards,

Vaibhav

virenp_devi
Contributor
0 Kudos

Hi Vaibhav,


Reg. DB procedure can you please elaborate on using one more table type as output?

Regards,

Viren

vairma
Advisor
Advisor
0 Kudos

Hi Viren,

You can create procedure in HANA under package of "Content" folder by right click on package then click on procedure[Refer screenshot 1].

Then on right side, you can create  multiple outputs let say [OUT_1 and OUT_2] and input parameter[IV_TOP].[Refer Screenshot 2].

OUT_1 and OUT_2 are of Table Type and IV_TOP is of scalar type.

Then, you can populate those output parameters using SQL SCRIPT like mentioned below.

BEGIN

OUT_1 = select top :iv_top COMPANY_NAME from SNWD_BPA;

OUT_2 = select top :iv_top SO_ID from SNWD_SO;

END;

Hope this helps.

Best Regards,

Vaibhav