1、新建文件NewFile 创建get_bp_addresses_by_role_sql.procedure
2、Local Table Type中定义本地类型
/* You can create new table types and use them as input and output parameters in a procedure. The table types must be defined using SQL syntax, for example: CREATE TYPE <Type Name> AS TABLE (<filed Name1> <Filed Type1>, <filed Name2> <Filed Type2>,...). */ create type tt_bp_addresses as table ( PartnerId nvarchar(10), PartnerRole nvarchar(3), EmailAddress nvarchar(255), CompanyName nvarchar(80), AddressId nvarchar(10), City nvarchar(40), PostalCode nvarchar(10), Street nvarchar(60) )
3、SQLScript Tab页中代码创建Procedure
CREATE PROCEDUREget_bp_addresses_by_role_sql ( in partnerrole nvarchar(3), out bp_addresses tt_bp_addresses ) LANGUAGESQLSCRIPT SQLSECURITY INVOKER READSSQL DATA AS BEGIN /***************************** Writeyour procedure logic *****************************/ bp_addresses = selecta."PartnerId", a."PartnerRole", a."EmailAddress",a."CompanyName", a."AddressId",b."City", b."PostalCode", b."Street" from"SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::businessPartner"as a inner join"SAP_HANA_EPM_DEMO"."sap.hana.democontent.epm.data::addresses"as b ona."AddressId" = b."AddressId" wherea."PartnerRole" = :partnerrole; END;
4、Team→Commit& Activate之后,在SQL Console中调用代码,生成procedure,如下图所示:
call"_SYS_BIC"."WorkShop.sessiona.00.models/get_bp_addresses_by_role_sql"( partnerrole =>'02', bp_addresses => ? )