Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8652

Re: How to call HANA store procedure with input table variable in a SQL console?

$
0
0

Hi,

You can call procedures with table type input parameters from SQL Console. But, you cannot specify these as ?s. What you can do is create temporary tables (or physical tables, views etc) and pass these as the parameters.  You can find examples for this in PAL user guide. Here is sample from there:

 

--CREATE TABLES
CREATE COLUMN TABLE PAL_KMEANS_DATA_TBL LIKE PAL_KMEANS_DATA_T;
INSERT INTO PAL_KMEANS_DATA_TBL VALUES (0 , 0.5, 'A', 0.5);
INSERT INTO PAL_KMEANS_DATA_TBL VALUES (1 , 1.5, 'A', 0.5);
-- and more
CREATE LOCAL TEMPORARY COLUMN TABLE #PAL_CONTROL_TBL LIKE PAL_CONTROL_T;
INSERT INTO #PAL_CONTROL_TBL VALUES ('THREAD_NUMBER',2,null,null);
INSERT INTO #PAL_CONTROL_TBL VALUES ('GROUP_NUMBER',4,null,null);
-- and more
CREATE COLUMN TABLE PAL_KMEANS_ASSIGN_TBL LIKE PAL_KMEANS_ASSIGN_T;
CREATE COLUMN TABLE PAL_KMEANS_CENTERS_TBL LIKE PAL_KMEANS_CENTERS_T;
--CALL PROCEDURE 2 input parameters, 2 output parameters
-- 1st parameter is a column table
-- 2nd parameter is a temporary table
-- output parameters are physical tables these could be ?s
CALL _SYS_AFL.PAL_KMEANS_PROC(PAL_KMEANS_DATA_TBL, #PAL_CONTROL_TBL,
PAL_KMEANS_ASSIGN_TBL, PAL_KMEANS_CENTERS_TBL) 
with OVERVIEW;
SELECT * FROM PAL_KMEANS_CENTERS_TBL;
SELECT * FROM PAL_KMEANS_ASSIGN_TBL;

Regards,

Dinu


Viewing all articles
Browse latest Browse all 8652

Trending Articles



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