Ask Your Question
0

How can a Table Type be provided as a parameter in a stored procedure in HANA?

asked 2023-07-07 04:20:47 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-07-07 04:42:01 +0000

ladyg gravatar image

In HANA, a table type can be provided as a parameter in a stored procedure by defining the input parameter with the data type of the table type.

For example, if you have created a table type called "myTableType", you can create a stored procedure that takes this table type as input parameter as follows:

CREATE TYPE myTableType AS TABLE (
  id INT,
  name NVARCHAR(50)
);

CREATE PROCEDURE myProcedure (IN inputTable myTableType)
  LANGUAGE SQLSCRIPT
  AS
  BEGIN
    -- Do something with the inputTable
  END;

In this stored procedure, the input parameter "inputTable" has the data type "myTableType", which is the table type defined earlier. When calling this stored procedure, you can pass a table of that type as a parameter:

DECLARE myTable myTableType;
-- Populate the table
EXECUTE myProcedure(:myTable);
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-07 04:20:47 +0000

Seen: 13 times

Last updated: Jul 07 '23