Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: How to input an array in store procedure

$
0
0

Hi Nithin,

 

1. When you create an .procedure file to create a procedure, you can create a local table type which can be used inside that procedure alone to input/output multiple values. Below screenshot shows one such table type.

 

 

In the table type tab next to SQLScript, you can create a local table type by adding code

 

CREATE TYPE tt_test AS TABLE ( col1 VARCHAR(4), col2 DECIMAL, col3 INTEGER);


CREATE TYPE tt_test2 AS TABLE(out1 INTEGER);


You can use it as input or output as below :


CREATE PROCEDURE test (IN tt_test_in tt_test, OUT tt_out tt_test2) ...


This acts as an array locally to that procedure.


2. If you want to declare global table types, you can go for CDS approach. You can create a .hdbdd file with below sample code:


namespace sap.hana.practice.tabletype;

@Schema: 'SOME_SCHEMA'

context GlobalTypes { 

type tt_test

{ col1: String(10);

col2: String(40);

col3: Decimal(15,2);}; };


Upon saving and activating, this table type is available under corresponding schema -> procedures -> tabletypes section. You can drag and drop and use it in the required procedure as array globaly.


Regards,

Anil


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>