hanahana-sql-script

Creating a Column Store Table Type in HANA


I am trying to create a table type which has ARRAY as a column type in SAP HANA. When I use the standard DDL for creating the table type, i.e.

CREATE TYPE MYSCHEMA.TABNAME AS TABLE("ObjList" INTEGER ARRAY);

I get the following error :

Could not execute 'CREATE TYPE "schema"."ListType" AS TABLE ( "ID" BIGINT CS_FIXED, ...'

SAP DBTech JDBC: [7]: feature not supported: cannot create row table having array type: ObjList

It is unclear from the documentation how to create a table type of column store type. Since I am passing ARRAY value from .NET code to Stored procedure in HANA for bulk update/upsert, I cannot do away with this requirement.

TIA


Solution

  • There is no way to create column table types - table types are always a row structure as they define how records should look like. Types don't store data, so there is no distinction between row/column/whatever here.

    For what you want to do - handing ARRAYs from a client application to SAP HANA - this difference doesn't matter since it's simply not possible to do that. You can pass arrays between procedures/functions and tables, but no external interface can feed data into them. Only with the ARRAY() function you can create arrays on the server-side. If you search for 'hana array' here on stackoverflow, you'll find that this has been discussed quite extensively already...

    Insert array in HANA with JAVA , Upload an array in HANA or How to insert an array in a loop to the database to list a few examples.