SapHanaTutorial.Com HOME     Learning-Materials Interview-Q&A Certifications Quiz Online-Courses Forum Jobs Trendz FAQs  
     Explore The World of Hana With Us     
About Us
Contact Us
 Apps
X
HANA App
>>>
Hadoop App
>>>
Tutorial App on SAP HANA
This app is an All-In-One package to provide everything to HANA Lovers.

It contains
1. Courses on SAP HANA - Basics, Modeling and Administration
2. Multiple Quizzes on Overview, Modelling, Architeture, and Administration
3. Most popular articles on SAP HANA
4. Series of Interview questions to brushup your HANA skills
Tutorial App on Hadoop
This app is an All-In-One package to provide everything to Hadoop Lovers.

It contains
1. Courses on Hadoop - Basics and Advanced
2. Multiple Quizzes on Basics, MapReduce and HDFS
3. Most popular articles on Hadoop
4. Series of Interview questions to brushup your skills
Apps
HANA App
Hadoop App
';
Search
Stay Connected
Search Topics
Topic Index
+
-
SQLScript
+
-
Tables in SAP HANA
+
-
Procedure
+
-
Examples of Procedure
SAP HANA Table Types


In this article we will learn about Table Type in SAP HANA.
Introduction to Table Type:

A table type is
    • Similar to a database table but do not have an instance
    • Used to define parameters for a procedure that represent tabular results.
In HANA, with the help of SQLScript, we can create a Table Type.

How to Create a Table Type:

A table type is created using statement CREATE TYPE and can be deleted using statement DROP TYPE.

Syntax:
CREATE TYPE [schema.]name AS TABLE
          (name1 type1 [, name2 type2,...])

DROP TYPE [schema.]name [CASCADE]

Example:

    1. Open HANA studio and run the below SQL statement to create a table type.
      Replace SCHEMA_NAME with your schema.

      CREATE TYPE SCHEMA_NAME.TT_SALES AS TABLE (
                  SALES_AMOUNT DECIMAL,
                  NET_AMOUNT DECIMAL,
                  PRODUCT_NAME NVARCHAR(20),
                  REGION_NAME NVARCHAR(20),
                  SUB_REGION_NAME NVARCHAR(20)
      );


    2. After executing the statement you can go to THE schema and find the table type under Procedures -> Table Types section.

      SAP HANA Table Type

    3. Double click on the table type to see the definition.

      SAP HANA Table Type

    4. Remember that we cannot add record to table type. If you try to insert record, you will get an error.
      INSERT INTO SCHEMA_NAME.TT_SALES VALUES (100, 'PROD-1', 'ASIA', 'INDIA');


      SAP HANA Table Type






Support us by sharing this article.



Explore More
Close X
Close X

5 thoughts on “SAP HANA Table Types

  1. Bijay Sahoo says:

    Very helpful (y)

  2. Sumit Kumar Lal says:

    For SAP UI5/Fiori Experience(2 yrs) guy,which certification we should go for it.

  3. Vishal says:

    Hi,
    Can you guide me on how to invoke procedure from Java, which accepts a table type input?
    Many thanks in advance,
    Regards,
    Vishal

  4. Viswanath says:

    Hi,

    When we want to change table type, how to change.
    For ex: we want to add one more filed in Table type or change data type for existing field.
    Kindly let me know how to do either Graphical or SQL ways.

Leave a Reply

Your email address will not be published. Required fields are marked *

Current day month ye@r *

 © 2017 : saphanatutorial.com, All rights reserved.  Privacy Policy