Creating Table User Defined Functions
January 5, 2021
Intermediate
15 min.
Leveraging SQLScript in Stored Procedures, User Defined Functions, and User Defined Libraries
You will learn
- How to transform a procedure to a table function.
Prerequisites
- This tutorial is designed for SAP HANA on premise and SAP HANA, express edition. It is not designed for SAP HANA Cloud.
- Tutorials: Creating Scalar User Defined Functions
There are application and scenarios where you need a table function instead of procedure to leverage the advantage of direct selects on the output, for example, filtering, sorting and grouping. In the following exercise, we show you how you can easily transform a procedure to a table function.
Step 1: Create New Function
Step 2: Modify Parameters
Step 3: Insert Code
Step 4: Edit WHERE Clauses
Step 5: Change Variable Name
Step 6: Remove LIMIT Clause
Step 7: Add a RETURN SELECT
Step 8: Check Complete Code
Step 9: Save and Build
Step 10: Enter Input Parameter
Navigate tutorial steps