Skip to Content
avatar image
-1
Former Member

selecting from hdbscalarfunction

Hi,

I've created a basic scalar UDF, but I'm not able to select from it using SQL for some reason. Does anyone know what is going on?

I'm able to define a .hdbscalarfunction file, activate it, see it in the catalog - but when I select I get this:

14:18:02 (SQL Editor) (dberror) 328 - invalid name of function or procedure: public::thefunc: line 1 col 28 (at pos 28)

Thanks for your help,
Dean.

1.png (15.4 kB)
2.png (6.9 kB)
3.png (3.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 20, 2017 at 04:42 AM

    It's not possible to SELECT from a scalar function, because the scalar function does not produce a row set, like tables, views, table-typed functions or procedures do.

    Any data source in your FROM clause has to produce a row set. That is pretty much fundamental to SQL in general, not just SAP HANA.

    Scalar functions are meant to be used like other built-in functions (e.g. UPPER(), or CURRENT_DATE()) - they provide a result for a single value (a scalar).

    In your example, you should be able to use

    SELECT 
         "public::thefunc"(1, 0) 
    FROM DUMMY;

    All this is of course described in the SAP HANA developer guides (included in SAP HANA Studio and freely available on help.sap.com).

    Add comment
    10|10000 characters needed characters exceeded