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

Re: Call Stored Procedure in SQL Script Calculation View

$
0
0

Hi Lars,

 

My Procedure code starts like this in my .procedure file. In the Local Table Types tab, i have created the table type.

 

//Procedure

CREATE PROCEDURE <NAME>(IN _I_KEY_DATE DATE, OUT O_HT_ORG_HIER "<Table Type Name>")

    LANGUAGE SQLSCRIPT

    SQL SECURITY DEFINER

    DEFAULT SCHEMA DEVADM

    READS SQL DATA AS

BEGIN

//Procedure code

END

 

//Table Type creation code

CREATE TYPE <Table type Name> AS TABLE ("_BIC_ZORGULV01" NVARCHAR(8), "_BIC_ZPOSCLV01" NVARCHAR(8), "_BIC_ZEMPCLV01" NVARCHAR(8), "_BIC_ZEMPSTS01" NVARCHAR(2));

In SQL console i call this Procedure using the below command, and it works fine as expected.

CALL <Procedure Name> (TO_DATE('2014-02-17', 'YYYY-MM-DD'), null)

I am trying to do the same in Calculation View as below,

/********* Begin Procedure Script ************/

 

BEGIN

//_I_KEY_DATE is the input parameter for Calc View

VAR_ORG_HIER = CALL <Procedure Name> (:_I_KEY_DATE, null);

How do I declare/define a variable of type as Table Type created for procedure, in Calc View?

 

I am running this on HANA rev 88.

 

Error message i am getting at the time of activation is

Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Deploy Calculation View: SQL: sql syntax error: incorrect syntax near "CALL": line 14 col 17 (at pos 533)nSet Schema DDL statement: set schema "SYSTEM"nType DDL: create type "_SYS_BIC"."<View Name>/proc/tabletype/VAR_OUT" as table ("_BIC_ZORGULV01" NVARCHAR(8), "_BIC_ZPOSCLV01" NVARCHAR(8), "_BIC_ZEMPCLV01" NVARCHAR(8), "_HCC_COUNT" NVARCHAR(8))nProcedure DDL: create procedure "_SYS_BIC"."<View Name>/proc" ( IN _I_KEY_DATE DATE,  OUT var_out "_SYS_BIC"."<view name>/proc/tabletype/VAR_OUT" ) language sqlscript sql security definer reads sql data as  /********* Header Start ************/ n /*ntNAME t: <view name>ntAUTHOR t: Vishweshwara P K MntDATE t: 02/12/2015ntPURPOSE : View to built Org HierarchyntVERSION : INITIALn*/n /********* Header End ************/ n  n /********* Begin Procedure Script ************/n n BEGIN ntVAR_ORG_HIER = CALL "_SYS_BIC"."ORGHIER/PR_HCM_201_ZORGHIER" (:_I_KEY_DATE, null);nt n tVAR_HT_ORG_HIER = SELECT n tORGHIER."_BIC_ZORGULV01", n tORGHIER."_BIC_ZPOSCLV01",n tORGHIER."_BIC_ZEMPCLV01",n t1 AS "_HCC_COUNT" n tFROM VAR_ORG_HIER AS ORGHIER;n tntvar_out = SELECT * FROM :VAR_HT_ORG_HIER; ntn END /********* End Procedure Script ************/n

 

 

Thanks & Regards,

Vishwa


Viewing all articles
Browse latest Browse all 9165

Trending Articles



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