Show Menu
Cheatography

SQL Script Cheat Sheet (DRAFT) by

SQL Script Cheat Sheet for SAP HANA

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Variables

DECLARE <name> <type>;
DECLARE <name> <type> := <value>;

TABLE TYPE

CREATE TYPE <type_name> AS TABLE (<column_list_definition>)

DROP TYPE <type_name>

PROCEDURE

 CREATE PROCEDURE <proc_name> (IN/OUT/INOUT <param_name> <type>)
[LANGUAGE <lang>] 
[SQL SECURITY <mode>] 
[DEFAULT SCHEMA <default_schema_name>]
[READS SQL DATA [WITH RESULT VIEW <view_name>]] AS
 BEGIN
   <procedure_body>
 END

DROP PROCEDURE <proc_name>

CALL <proc_name> (<param_list>)
 

IF/ELSE

IF <bool_expr1>
THEN
    <then_stmts1>
ELSEIF <bool_expr2>
THEN
    <then_stmts2>
ELSE
    <else_stmts3>
END IF