Skip to Content

SQL and CONTAINS

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Oct 26, 2016 at 06:38 AM

    To whom it may concern:

    Masking the search string with wildcards works fine:

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

    Regards

    Rolf

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 15, 2016 at 09:48 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 16, 2016 at 07:40 AM

    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).

    Add comment
    10|10000 characters needed characters exceeded