Skip to Content
-1

selecting from hdbscalarfunction

Dec 20, 2017 at 03:56 AM

32

avatar image
Former Member

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)
SQL
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Lars Breddemann
Dec 20, 2017 at 04:42 AM
0

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).

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you Lars, apologies for the simple question.

0