Application Development and Automation 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: 
Read only

SQL and CONTAINS

Former Member
0 Likes
5,397

Hi Experts,

I want to use the fuzzy search in SQL Select statements on standard SAP tables (e.g. PRPS) with the CONTAINS predicate. In OPEN SQL this does not work. So I use native SQL an our HANA Database.

But whenever I use the contains predicate (e.g. "where contains(post1, 'e', FUZZY(0.1)") I get no rows returned. Without the contains predicate the select statement returns the correct rows.

Any hints?

Regards

Rolf

6 REPLIES 6
Read only

Former Member
0 Likes
3,001

To whom it may concern:

Masking the search string with wildcards works fine:

where contains(post1, '%e%', FUZZY(0.1)

Regards

Rolf

Read only

0 Likes
3,001

If this is answered then please close your question (see Actions button). Otherwise it still shows up on the list of unanswered questions.

Thank you.

Read only

0 Likes
3,001

The question is not answered. The fuzzy option does not work. Any hints welcome.

Regards

Rolf

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
3,001

In ABAP / Open SQL even before HANA we can use an asterisk as a wildcard. So if I wanted to find a string that contained 'e' then I'd put '*e*' in the selection option. Percentage sign is used with LIKE, if memory serves.

But wildcards already are "fuzzy search", so I don't really understand what you are trying to achieve with such combination. You might want to clarify.

Read only

matt
Active Contributor
0 Likes
3,001

I've modified your subject to remove the ABAP as it isn't really an ABAP question - it's native SQL.

Read only

matt
Active Contributor
0 Likes
3,001

Have you tried the SQL from HANA studio in the console? Does it work there? If it does, then the problem lies in the way that you're constructing your SQL within ABAP.

If it doesn't, then we know it's an SQL syntax issue. (And this is what I expect, but it is worth checking).