Database Procedures
They are the most flexible mechanism to implement data-intensive calculations in SAP HANA, and for which SQL Script can be used.
The following are some options to define database procedures in SAP HANA:
CREATE PROCEDURE <procedure name>
[(<parameter clause>)]
[LANGUAGE <lang>]
[SQL SECURITY <mode>]
[DEFAULT SCHEMA <default_schema_name>]
[READS SQL DATA]
AS
BEGIN [SEQUENTIAL EXECUTION]
<procedure body>
END;
Elements of a procedure header
The following are elements of a procedure header:

Database procedures can have several output parameters, and a mix of parameters of scalar and table types is possible.
They can also have input parameters and parameters which are both input and output. Therefore, the keywords IN, OUT and INOUT are necessary for the definition of the signature to indicate the kind of parameter. IN is the default.
Several optional clauses can be used in the procedural header. The most important one is the following:
READS SQL DATA prevents the use of constructs in the procedure body that could lead to side effects, for example, INSERT statements or dynamic SQL using EXEC. Remove this is you wish to use statements that will modify the database.
Declarative Logic in SQL Script
Using declarative logic only, which implies side-effect-free programming, has a very big advantage:

Deleting Stored procedures
DROP PROCEDURE <procedure name>
Error Reporting
Procedures can have table and scalar output parameters, which can be used to return more readable error messages in case of exceptions. The figure USING SQL Errors in Exceptions

Executing Stored Procedures
To call a procedure, use the CALL statement. There are different options depending on where you call the procedure and for passing parameters, as shown in the figure Calling Procedures.
Arguments for IN parameters of table type can either be physical tables, views or table variables. The actual value passed for tabular OUT parameters must be ‘?’ when calling a procedure in the SQL Console.

Calling a procedure WITH OVERVIEW will return one result set that holds the information of which table contains the result of a table output parameter. Scalar outputs are represented as temporary tables with only one cell. When you pass existing tables to the output parameters, WITH OVERVIEW inserts the result set tuples of the procedure into the provided tables. When you pass ‘?’ to the output parameters, temporary tables holding the result sets are generated. These tables are dropped automatically when the database session is closed.
We will create a procedure but we will use the recommended approach which is to develop a source file with the extension .hdbprocedure in the development view of Web IDE.