Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone know the HANA equivalent of the following SQL statement?

0 Kudos
1,174
  • SAP Managed Tags:

I am trying to enable a multi-select function from the data model of my parameter in Tableau, but the code I use for my Oracle data models is not working. Does anyone know the HANA equivalent?

select trim(UPPER( regexp_substr(<Parameters.SAPProjectParameter>,'[^,]+',1,level))) from dual

connect by UPPER( regexp_substr(<Parameters.SAPProjectParameterr>,'[^,]+',1,level)) is not null))

Thank you in advance!

6 REPLIES 6

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos
972
  • SAP Managed Tags:

Thank you for visiting SAP Community to get answers to your questions. Since this is your first question, I recommend that you familiarize yourself with Community Q&A, as the overview provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question by selecting Actions, then Edit.

By adding a Picture to your profile you encourage readers to respond.

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos
972
  • SAP Managed Tags:

jwalls1221

can we know what is the <Parameters.SAPProjectParameter> to be passed ?

0 Kudos
972
  • SAP Managed Tags:

Yes, this is a parameter in my Tableau workbook that the user selects on a dashboard which dictates which program the user would like to analyze. My goal is to allow the user to multi-select projects which is what I use the statement for in my other Tableau workbooks. However, the other workbook data models are Oracle-based, whereas this one is HANA-based.

Essentially, I'd like the statement to dictate that if multiple projects are selected in the SAPProjectParameter, these selections should be concatenated with a comma in between them. However, if a user only selects one project, it should only render data for that project with no augmentation to how it is being queried.
I tried to re-write it based on some changes I know would need to be made between Oracle and HANA and this is what I came up with, but I am still getting an error:

select trim(UPPER( substr_regexp(<Parameters.SAPProjectParameter>,'[^,]+',1,level))) from dummy

connect by UPPER( substr_regexp(<Parameters.SAPProjectParameter>,'[^,]+',1,level)) is not null))

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos
972
  • SAP Managed Tags:
SELECT TRIM(UPPER(SUBSTRING_INDEX(<Parameters.SAPProjectParameter>,',',1)))
FROM DUMMY
CONNECT BY SUBSTRING_INDEX(<Parameters.SAPProjectParameter>,',',1) IS NOT NULL

jwalls1221

thanks for the above reply... I am hoping this select will work in HANA but not sure on Parameters.SAPProjectParameter part.

0 Kudos
972
  • SAP Managed Tags:

When I use that code, I get the following error:

[SAP AG][LIBODBCHDB DLL][HDBODBC] Syntax error or access violation;257 sql syntax error: incorrect syntax near "SELECT": line 38 col 3 (at pos 2801)

Thoughts?

0 Kudos
972
  • SAP Managed Tags:

yoganandamuthaiah