on 04-05-2016 5:52 AM
Hi Experts,
I have a requirement in HANA where in I have data like below.
| 404856883 | FA212,FA214, |
| 404856883 | FA211,FA213,FA204 |
| 404856883 | FA203,FA195,FA177 |
| 404856883 | FA204,FA177, |
I need to convert to as below.
| 404856883 | FA212 |
| 404856883 | FA214 |
| 404856883 | FA211 |
| 404856883 | FA213 |
| 404856883 | FA204 |
| 404856883 | FA203 |
| 404856883 | FA195 |
| 404856883 | FA177 |
| 404856883 | FA204 |
| 404856883 | FA177 |
Can I achieve it in HANA SQL?
In Data services we can achieve, can we achieve it in HANA, without going into Procedure logic. As I have to bring the First table data virtually from Teradata.
Please help.
Regards,
Chandan
Nope, there's no SQL function for that.
You probably could write a SQL Script function for that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Lars for your response.
Based on my requirement, I tried using REGEXPR as I am in SP10. to split it to 3 columns. And some how able to achieve the functionality.
For REGEXPR also there was no adequate reference on SCN. I will create a separate blog for that.
below is the dummy logic, I thought of using.
Hope this will help for the community to use REGEXPR
SELECT SUBSTR_REGEXPR('([[:alnum:][:punct:]]{5})([[:alnum:][:punct:]]{6})([[:alnum:][:punct:]]{6})' IN
'FA168,FA162,FA165,' GROUP 1) "substring_regexpr" FROM DUMMY;
SELECT SUBSTR_REGEXPR('([[:alnum:][:punct:]]{6})([[:alnum:][:punct:]]{5})([[:alnum:][:punct:]]{6})' IN
'FA168,FA162,FA165,' GROUP 2) "substring_regexpr" FROM DUMMY;
SELECT SUBSTR_REGEXPR('([[:alnum:][:punct:]]{6})([[:alnum:][:punct:]]{6})([[:alnum:][:punct:]]{5})' IN
'FA168,FA162,FA165,' GROUP 3) "substring_regexpr" FROM DUMMY;
Regards,
Chandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 3 | |
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.