Skip to Content
author's profile photo Former Member
Former Member

returning two tables in a function in hana??

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jan 03, 2014 at 08:00 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Vaibhav KUMAR Viren Pravinchandra Devi

      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

      Proc1.JPG (70.6 kB)
      Proc2.JPG (44.2 kB)

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.