Académique Documents
Professionnel Documents
Culture Documents
SQLScript is
Extension of ANSI standard SQL
Language for creating stored procedures in SAP HANA
Declarative Logic
SELECT queries
Calculation engine (CE) functions
Orchestration Logic
Data Definition Language (DDL)
Data Manipulation Language (DML)
Assignment and imperative logic
Public
New Model:
Code to Data
Traditional:
Data to Code
Application Layer
Application Layer
Code
Transfer
minimum
result set
Massive
data copies
creates
bottleneck
DB Layer
DB Layer
Code
Public
SQLScript Editor
hdbprocedure file extension
Source code stored in the
repository
Source code-based editor
Client-side syntax checking
Code hints
Syntax highlighting
Public
Allows the developer to declare the data selection via SELECT or calculation
engine (CE) functions
Developer defines the what
Engine defines the how and executes accordingly
Massively parallelized
Public
Public
Set elements
Return elements
Remove elements
Concatenate two arrays
Turn array into a table
Turn a column of a table into an
array
Return cardinality of an array
Public
Public
Public
Thank you
Contact information:
open@sap.com
Public
11
Week 3 Unit 2:
Triggers
Triggers
Overview
Public
Triggers
Limitations
Public
Triggers
Examples (1)
Public
Triggers
Examples (2)
Public
Thank you
Contact information:
open@sap.com
Public
Week 3 Unit 3:
Exception Handling
Exception Handling
Overview
Exception handling
is a method for handling exception and
completion conditions
DECLARE EXIT HANDLER
DECLARE CONDITION
SIGNAL or RESIGNAL
Public
Exception Handling
SQL Exceptions
Public
Exception Handling
Signaling User-Defined Conditions
Public
Exception Handling
Re-signaling
Public
Thank you
Contact information:
open@sap.com
Public
Week 3 Unit 4:
User-Defined Functions
User-Defined Functions
Overview
Public
User-Defined Functions
Table UDF (1)
Public
User-Defined Functions
Table UDF (2)
Public
User-Defined Functions
Scalar UDF (1)
Public
User-Defined Functions
Scalar UDF (2)
Public
Thank you
Contact information:
open@sap.com
Public
Week 3 Unit 5:
Application Function Library
(AFL)
Public
AFL framework
On-demand library-loading framework for
registered and supported libraries
AFLs are consumed for use from SQLScript via
wrapper procedures. Consumption can be
controlled via permissions
Beyond the initial script-based approach, the
Application Function Modeler is released with
SPS06 as a graphical editor to facilitate the
design-time process of creating the
wrapper procedures, and can easily be re-used as
part of development workflow
2014 SAP SE or an SAP affiliate company. All rights reserved
AFM
SQLScript
Parameter Table
AFL Framework
Business
Function
Library
Public
Compute quickly
Public
capitalization[1] := '100000';
lt_capitalization = unnest(:capitalization) as ("VALUE");
rate[1] := '0.1';
lt_rate = unnest(:rate) as ("VALUE");
flag[1] := '0';
lt_flag = unnest(:flag) as ("VALUE");
capitalizationtype[1] := '0';
lt_capitalizationtype = unnest(:capitalizationtype) as ("VALUE");
periods[1] := '24';
lt_periods = unnest(:periods) as ("VALUE");
CALL "_SYS_AFL"."AFLBFL_DBDEPRECIATION_PROC"(:lt_capitalization,
:lt_rate, :lt_flag,
:lt_capitalizationtype,
:lt_periods,
:lt_depreciation);
ex_depreciation_tab = SELECT TO_DECIMAL(DEP_VALUE, 9, 2)
...
Public
Help customers to
Know the business
Compute quickly
Public
Supported Algorithms
Association Analysis
Classification Analysis
Regression
Cluster Analysis
Time Series Analysis
Probability Distribution
Outlier Detection
Statistic Functions (Univariate)
Link Prediction
Data Preparation
Statistic Functions (Multivariate)
X
Z
Public
INTO
INTO
INTO
INTO
SAP_HANA_EPM_NEXT.PAL_KMEANS_PDATA_TBL
SAP_HANA_EPM_NEXT.PAL_KMEANS_PDATA_TBL
SAP_HANA_EPM_NEXT.PAL_KMEANS_PDATA_TBL
SAP_HANA_EPM_NEXT.PAL_KMEANS_PDATA_TBL
VALUES
VALUES
VALUES
VALUES
(1,
(2,
(3,
(4,
'SAP_HANA_EPM_NEXT.PAL_KMEANS_DATA_T', 'in');
'SAP_HANA_EPM_NEXT.PAL_CONTROL_T', 'in');
'SAP_HANA_EPM_NEXT.PAL_KMEANS_ASSIGNED_T', 'out');
'SAP_HANA_EPM_NEXT.PAL_KMEANS_CENTERS_T', 'out');
call "SYSTEM".afl_wrapper_eraser('PAL_KMEANS_PROC');
call "SYSTEM".afl_wrapper_generator('PAL_KMEANS_PROC', 'AFLPAL', 'KMEANS',
SAP_HANA_EPM_NEXT.PAL_KMEANS_PDATA_TBL);
DROP
DROP
DROP
DROP
DROP
TABLE SAP_HANA_EPM_NEXT.PAL_KMEANS_PDATA_TBL;
TYPE SAP_HANA_EPM_NEXT.PAL_KMEANS_DATA_T;
TYPE SAP_HANA_EPM_NEXT.PAL_KMEANS_ASSIGNED_T;
TYPE SAP_HANA_EPM_NEXT.PAL_KMEANS_CENTERS_T;
TYPE SAP_HANA_EPM_NEXT.PAL_CONTROL_T;
Public
...
lt_PAL_KMEANS_DATA_TBL = unnest(:data_id, :data_v000, :data_v001, :data_v002)
as ("ID", "V000", "V001", "V002");
CALL "_SYS_AFL".PAL_KMEANS_PROC( :lt_PAL_KMEANS_DATA_TBL,
:lt_PAL_CONTROL_TBL,
:lt_PAL_KMEANS_ASSIGNED_TBL,
:lt_PAL_KMEANS_CENTERS_TBL);
ex_pal_kmeans_assigned_tbl = SELECT * FROM :lt_PAL_KMEANS_ASSIGNED_TBL;
ex_pal_kmeans_centers_tbl = SELECT * FROM :lt_PAL_KMEANS_CENTERS_TBL;
...
Public
Sample SQL
for procedure
consumption
Function List
and Search
Library
Selection
Parameters and
specifications
for table types
Public
10
Thank you
Contact information:
open@sap.com
Public
12
Plan Visualizer
Overview
Public
Thank you
Contact information:
open@sap.com
Public
Public
Marker interface
Method additions
Forward
declaration of
accessed
database objects
Public
Thank you
Contact information:
open@sap.com
Public