1

Is it possiible to split a comma separated string in Hana into rows without using a user defined function.

Something like this from oracle :

SELECT DISTINCT REGEXP_SUBSTR ('23,34,45,56','[^,]+',1,LEVEL) as "token"
FROM   DUAL
CONNECT BY REGEXP_SUBSTR ('23,34,45,56','[^,]+',1,LEVEL) IS NOT NULL
order by 1

2 Answers 2

1

The example you gave in the question mixes regular expression handling as well as hierarchy processing. Both can be done in SAP HANA with the appropriate commands.

SUBSTRING_REGEXPR is the HANA version of the function you used in the example.

As I'm not sure what you want to achieve with the CONNECT BY clause, I'll just vaguely hint towards the HIERARCHY-functions here.

Sign up to request clarification or add additional context in comments.

3 Comments

Hello @Lars Br. I need the output of string (23,34,45,56) to be something like : Token 23 34 45 56 That's what I wanted to achieve through Level and Connect by. Couldn't find the alternative functions for the same in Hana.
So, do you actually want to have these tokens as separate rows? If so, please update the question appropriately.
I updated, is there anyway to achieve it. I've made a UDF function for the same. But just curious if this can be achieved with normal sql query.
0

Yes we have STRING_SPLIT System defined function but it is will only applicable in MSSQLSERVER 2016 and later version.

Simply it supports from compatability level 130 and above.

So We need to write udf when we are working in previous version of sql server

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.