Whats new in SAP HANA SPS 11 SQL/SQLScript
-
Upload
sap-technology -
Category
Data & Analytics
-
view
3.612 -
download
2
Transcript of Whats new in SAP HANA SPS 11 SQL/SQLScript
1© 2014 SAP AG or an SAP affiliate company. All rights reserved.
SAP HANA SPS 11 - What’s New? HANA SQL
SAP HANA Product Management December, 2015
(Delta from SPS 10 to SPS 11)
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 2Public
Disclaimer
This presentation outlines our general product direction and should not be relied on in making
a purchase decision. This presentation is not subject to your license agreement or any other
agreement with SAP.
SAP has no obligation to pursue any course of business outlined in this presentation or to
develop or release any functionality mentioned in this presentation. This presentation and
SAP’s strategy and possible future developments are subject to change and may be changed
by SAP at any time for any reason without notice.
This document is provided without a warranty of any kind, either express or implied, including
but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or
non-infringement. SAP assumes no responsibility for errors or omissions in this document,
except if such damages were caused by SAP intentionally or grossly negligent.
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 3Public
Agenda
CASE JOIN
New SQL Functions
Supportability
Projection Views
CASE JOIN
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 5Public
New JOIN Type for “Extension by Custom Fields” and Views
ext1
br2
BSEG
VBSEGD
br1
ext2
Union All View
BSEG br1 br2VBSEGD
ext1BSEG br1
br2VBSEGD
Final View
New: Case Join Select * from V left outer many to one case join
when br = 'br1' then
return ext1 as ext from BSEG on V.key = BSEG.key
when br = 'br2' then
return ext2 as ext from VBSEGD on V.key = VBSEGD.key
end;
pruning out unnecessary self-joins,
re-define only the top-most view ext2
SQL Functions
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 7Public
SQL Functions
group_contains(), group_why_found(), group_score()
• Query searches for objects that match a pattern over multi-records and multi-columns
to_snumc(), snumc_to_int(), snumc_to_bigint(), snumc_to_decimal()
• current to_alphanum() function converts integer-values in a character-format, which is specifically used to
integrate “external” integer data directly into the BW-Reporting as characteristics
• non-SQL standard behavior (cannot be pushed down to other DBMS for SDA, no support for DT)
• No support for negative numbers
• New functions preserves order in target string and can handle negative numbers
Supportability
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 9Public
Monitoring Views
M_EXECUTED_STATEMENTS (New)
Historize executed DDL operations
Similar fields like m_expensive_statements, but includes error_code and error_text
Enabled by default
M_EXPENSIVE_STATEMENTS (ENHANCED); downported to rev102
Column “workload_class_name” added
Displays mapped workload class of a statement (if workload class is defined)
M_CONNECTIONS (ENHANCED); downported to rev102
Column “close_reason” added, e.g. 'due to idle connection timeout’
empty for normal cases
Projection View
© 2015 SAP SE or an SAP affiliate company. All rights reserved. 11Public
Projection View
New Viewtype
New:
– Can be used in HANA column views
– Insert/Update/Delete triggers on projection view are supported
Syntax:
– CREATE PROJECTION VIEW < view_name> [(<column_name_list>)] AS SELECT <field_list> FROM [<schema>.]<table_name>
– DROP VIEW <view_name>
Pre-requisite
– Projection view must include all primary keys of the underlying table
12© 2014 SAP AG or an SAP affiliate company. All rights reserved.
SAP HANA SPS 11 - What’s New? SQLScript
SAP HANA Product Management November, 2015
(Delta from SPS 10 to SPS 11)
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 13
SQLScript – What’s New in SPS 11?
Tooling
No new developments for SPS 11
Language
ALTER PROCEDURE/ALTER FUNCTION Support
TRUNCATE Support
Filter pushdown for Table User Defined Functions
System Variables for Current Objects
Default Values for Table Variables and Parameters
DEFAULT EMPTY for Table IN/OUT Parameters
IS_EMPTY() Function for Table and Table Variables
Index-based Cell Access for Table Variables and Parameters
HANA Spatial Support
SQL Injection Prevention Build-in Procedures
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 14
SQLScript – What’s New in SPS 11Filter Pushdown for Table User Defined Functions
• Filter by column of table UDF via
WHERE clause
• Filter is pushed down, and result
set is not materialized before the
filtering
• Prior to SPS11, filter pushdown
was blocked for table UDF which
contained imperative logic
constructs.
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 15
SQLScript – What’s New in SPS 11System Variables for Object Name and Schema
• Use
::CURRENT_OJECT_SCHEMA
to return the schema name of
the current procedure or
function
• Use
::CURRENT_OBJECT_NAME
to return the name of the
current procedure or function
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 16
SQLScript – What’s New in SPS 11Default Values for Table Variables & Parameters
• Used to initialize table
variables and parameters
with tabular data
• Reference a persisted table
which contains the data
• DEFAULT can also be used
within the DECLARE
statement
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 17
SQLScript – What’s New in SPS 11Default Empty IN/OUT Table Parameters
• Used to initialize IN/OUT
table parameters
• If DEFAULT EMPTY is not
used and no assignment to
the output parameter exists
in the body, an error occurs.
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 18
SQLScript – What’s New in SPS 11IS_EMPTY
• Used to determine if a table
variable/parameter or table contains
any rows
SPS10 SPS11
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 19
SQLScript – What’s New in SPS 11Index-based Cell Access for Table Variables
• Used to directly access any cell
(read/write) within a table
variable or parameter
• <table>.<column>[<index>]
notation
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 20
SQLScript – What’s New in SPS 11Spatial Support
• SQLScript supports the
spatial data type
ST_GEOMETRY and SQL
spatial functions to access
and manipulate the spatial
data.
• SQLScript also supports the
objective style function
calls, which is needed for
some SQL spatial functions.
© 2014 SAP AG or an SAP affiliate company. All rights reserved. 21
SQLScript – What’s New in SPS 11Injection Prevention Built-In Procedure
• There is a danger of SQL injection attack if dynamic SQL statements are used, where the parts
of it are derived from untrusted input (e.g. user interface).
• ESCAPE_SINGLE_QUOTES(string_var)
used for variables containing a SQL string literal
• ESCAPE_DOUBLE_QUOTES(string_var)
used for variables containing a delimited SQL identifier
• IS_SQL_INJECTION_SAFE(string_var[, num_tokens])
used to check that a variable contains safe simple SQL identifiers (up to num_tokens, default is 1)
© 2015 SAP SE or an SAP affiliate company. All rights reserved.
Thank you
Contact information
Ruediger Karl & Rich Heilman
SAP HANA Product Management