arrayshana-studio

Max Index of Array SAP HANA


Does anyone know how to get the Max Index of an array in SAP Hana (stored procedure).

How can I get the Maximum Index via a single call for populated SAP Hana String array.
I am looking for something similar to:

MaxIdx := stringarray.RowCount;    

Solution

  • You can get the maximum Index with the function

    CARDINALITY
    

    For your example:

    MaxIdx := CARDINALITY(:stringarray);
    

    Source: http://help.sap.com/hana/sap_hana_sql_script_reference_en.pdf