Reputation: 41
Is it possible to call a Java function from a HANA database? In my case, the Java function will take an input XML and return a formatted array output. What will the HANA SQL call look like?
Upvotes: 1
Views: 494
Reputation: 164
You could do this operation using the SQL function. XMLTABLE:
SELECT * FROM
XMLTABLE('/doc/item' PASSING
'<doc>
<item><id>10</id><name>Box</name></item>
<item><id>20</id><name>Jar</name></item>
</doc>'
COLUMNS
line_num FOR ORDINALITY,
ID INT PATH 'id',
NAME VARCHAR(20) PATH 'name'
) as XTABLE;
Output:
| line_num | ID | NAME |
| --------- | ---- | ----- |
| 1 | 10 | Box |
| 2 | 20 | Jar |
Bear in mind in only works on HANA 2 SP 2. official doc for xmltable function
Upvotes: 0