<<

PUBLIC Document Version: 2021.05 – 2021-03-06

SQL Reference for SAP Warehouse Cloud company. All rights reserved. affiliate

THE BEST RUN 2021 SAP SE or an SAP © Content

1 SQL Reference for SAP Cloud...... 3 1.1 Select Statement...... 6 1.2 Functions...... 6 1.3 Expressions...... 9 1.4 API...... 9

SQL Reference for SAP Data Warehouse Cloud 2 PUBLIC Content 1 SQL Reference for SAP Data Warehouse Cloud

This guide describes the SQL statements for SAP Data Warehouse Cloud.

This section describes the SAP Data Warehouse Cloud implementation of Structured Query Language (SQL) that is used in the Data Builder, for example, when creating an SQL or a graphical view.

SAP Data Warehouse Cloud SQL is aligned with the SQL used by SAP HANA Cloud.

 Note

Please note that only the listed statements and functions in SAP Data Warehouse Cloud are supported and that some functions or statements listed in the SAP HANA Cloud SQL Reference Guide are, therefore, not supported.

You find a list of supported functions available in SAP Data Warehouse Cloud in the Data Builder either in the Graphical View builder or in the SQL View builder.

SQL Reference for SAP Data Warehouse Cloud SQL Reference for SAP Data Warehouse Cloud PUBLIC 3 In the Graphical View builder click on the filter icon of your object:

SQL Reference for SAP Data Warehouse Cloud 4 PUBLIC SQL Reference for SAP Data Warehouse Cloud You'll find a list of supported functions in the filter properties:

In the SQL View builder, only statements or functions that pop up in the value help are supported:

SQL Reference for SAP Data Warehouse Cloud SQL Reference for SAP Data Warehouse Cloud PUBLIC 5 1.1 Select Statement

The SELECT statement is used to retrieve information from the .

SAP Data Warehouse Cloud currently only supports and uses the select statement of SAP HANA SQL. If the statement refers to other sections of the SQL Guide, then these are also valid.

Please see SELECT Statement (Data Manipulation) in the SAP HANA Cloud SQL Reference Guide for detailed information.

1.2 Functions

SAP Data Warehouse Cloud comes with built-in functions provided by SAP HANA Cloud.

Please see SQL Functions in the SAP HANA Cloud SQL Reference Guide for detailed information.

 Note

Please note that only the listed statements and functions in SAP Data Warehouse Cloud are supported and that some functions or statements listed in the SAP HANA Cloud SQL Reference Guide are, therefore, not supported.

You find a list of supported functions available in SAP Data Warehouse Cloud in the Data Builder either in the Graphical View builder or in the SQL View builder.

SQL Reference for SAP Data Warehouse Cloud 6 PUBLIC SQL Reference for SAP Data Warehouse Cloud In the Graphical View builder click on the filter icon of your object:

SQL Reference for SAP Data Warehouse Cloud SQL Reference for SAP Data Warehouse Cloud PUBLIC 7 You'll find a list of supported functions in the filter properties:

In the SQL View builder, only statements or functions that pop up in the value help are supported:

SQL Reference for SAP Data Warehouse Cloud 8 PUBLIC SQL Reference for SAP Data Warehouse Cloud  Tip

An alternative to using TOP, which is not supported in SAP Data Warehouse Cloud is to use limit.

So, instead of using:

SELECT TOP 3 "SMALL_INT" FROM "ALLDATASV0" ORDER BY "SMALL_INT" DESC

You can use:

SELECT "SMALL_INT" FROM "ALLDATASV0" ORDER BY "SMALL_INT" DESC limit 3

1.3 Expressions

SAP Data Warehouse Cloud comes with expressions provided by SAP HANA Cloud. An expression is a clause that can be evaluated to return values.

Please see Expressions in the SAP HANA Cloud SQL Reference Guide for detailed information.

 Note

Only expressions that are displayed in SAP Data Warehouse Cloud are supported and, thus, it's possible that expressions that are listed in the SAP HANA Cloud SQL Reference Guide are not supported in SAP Data Warehouse Cloud.

1.4 Data Lake API

SAP Data Warehouse Cloud provides two procedures to access SAP HANA Cloud, data lake.

The following procedures are available in the schema DWC_GLOBAL:

SQL Reference for SAP Data Warehouse Cloud SQL Reference for SAP Data Warehouse Cloud PUBLIC 9 ● "DWC_GLOBAL"."DATA_LAKE_EXECUTE" ( IN STMT NCLOB )

This procedure is used to execute statements in data lake. It's a wrapper procedure around the data lake procedure REMOTE_EXECUTE. This enables you to create or drop tables in data lake, or to load data from files.

● "DWC_GLOBAL"."DATA_LAKE_CREATE_VIRTUAL_TABLE"

( IN VIRTUAL_TABLE_NAME NVARCHAR(256), IN DATA_LAKE_TABLE_NAME NVARCHAR(256), IN TARGET_SCHEMA_SYS BOOLEAN DEFAULT false

).

● This procedure provides the option to create SAP HANA virtual tables in the open SQL schema that refer to objects in data lake. These virtual tables are used to query data in the data lake. For more information see Data Lake SQL Statements Versus SAP HANA Cloud SQL Statements. The procedure can also be used to access system views of data lake in schema SYS. The optional IN parameter IN_TARGET_SCHEMA_SYS needs to be to true to create a virtual table on a data lake system view. For more information see System Views [Data Lake]. Virtual tables can be dropped directly using DROP TABLE syntax. For more information see Query Data Lake Data.

Example

Creating a table in data lake:

CALL "DWC_GLOBAL"."DATA_LAKE_EXECUTE"('CREATE TABLE TABLE1 ( MY_ID INTEGER ) ');

Creating a virtual table in open SQL schema:

CALL "DWC_GLOBAL"."DATA_LAKE_CREATE_VIRTUAL_TABLE"

( VIRTUAL_TABLE_NAME => 'TABLE1_VT', DATA_LAKE_TABLE_NAME => 'TABLE1'

) ;

Inserting a record in the table:

INSERT INTO table1_vt VALUES (2);

Selecting data from the virtual table:

SELECT * FROM table1_vt;

Dropping the virtual table:

DROP TABLE table1_vt;

Dropping the table in data lake:

CALL "DWC_GLOBAL"."DATA_LAKE_EXECUTE"('DROP TABLE TABLE1');

SQL Reference for SAP Data Warehouse Cloud 10 PUBLIC SQL Reference for SAP Data Warehouse Cloud Accessing the system views via the virtual table:

CALL "DWC_GLOBAL"."DATA_LAKE_CREATE_VIRTUAL_TABLE"

( VIRTUAL_TABLE_NAME => 'SYSTAB', DATA_LAKE_TABLE_NAME => 'SYSTAB', TARGET_SCHEMA_SYS => true

) ;

SQL Reference for SAP Data Warehouse Cloud SQL Reference for SAP Data Warehouse Cloud PUBLIC 11 Important Disclaimers and Legal Information

Hyperlinks

Some links are classified by an icon and/or a mouseover text. These links provide additional information. About the icons:

● Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your agreements with SAP) to this:

● The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information. ● SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.

● Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such links, you agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this information.

Videos Hosted on External Platforms

Some videos may point to third-party video hosting platforms. SAP cannot guarantee the future availability of videos stored on these platforms. Furthermore, any advertisements or other content hosted on these platforms (for example, suggested videos or by navigating to other videos hosted on the same site), are not within the control or responsibility of SAP.

Beta and Other Experimental Features

Experimental features are not part of the officially delivered scope that SAP guarantees for future releases. This means that experimental features may be changed by SAP at any time for any reason without notice. Experimental features are not for productive use. You may not demonstrate, test, examine, evaluate or otherwise use the experimental features in a live operating environment or with data that has not been sufficiently backed up. The purpose of experimental features is to get feedback early on, allowing customers and partners to influence the future product accordingly. By providing your feedback (e.g. in the SAP Community), you accept that intellectual property rights of the contributions or derivative works shall remain the exclusive property of SAP.

Example Code

Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax and phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of example code unless damages have been caused by SAP's gross negligence or willful misconduct.

Gender-Related Language

We try not to use gender-specific word forms and formulations. As appropriate for context and readability, SAP may use masculine word forms to refer to all genders.

SQL Reference for SAP Data Warehouse Cloud 12 PUBLIC Important Disclaimers and Legal Information SQL Reference for SAP Data Warehouse Cloud Important Disclaimers and Legal Information PUBLIC 13 www.sap.com/contactsap

© 2021 SAP SE or an SAP affiliate company. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. The information contained herein may be changed without prior notice.

Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary.

These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies.

Please see https://www.sap.com/about/legal/trademark.html for additional trademark information and notices.

THE BEST RUN