I have a function that calculates the distance between 2 strings.
Doing so with various fields, I can calculate whether 2 users are the same/similar or not, by doing this in the "MS SQL Server Management Studio" (see discussion
here).
Code:
with Search_distances as (
select
dbo.LEVENSHTEIN (USEARCH.logonuid, :logonuid) distance_logonuid,
dbo.LEVENSHTEIN (USEARCH.firstname, :firstname) distance_first,
dbo.LEVENSHTEIN (USEARCH.lastname, :lastname) distance_last,
dbo.LEVENSHTEIN (USEARCH.e_mail, :e_mail) distance_mail,
USER_ID,
logonuid,
e_mail,
firstname,
lastname,
search_field,
telephones
from
SCHEMA.USER_SEARCH USEARCH
)
select
distance_logonuid,
distance_first,
distance_last,
distance_mail,
USER_ID,
logonuid,
e_mail,
firstname,
lastname,
search_field,
telephones
from
Search_distances
where
distance_logonuid < 20
and distance_first < 20
and distance_last < 20
and distance_mail < 20
However this fails on the first word "with" :
Code:
01:16:52,384 ERROR PARSER:33 - line 1:1: unexpected token: with
Exception in thread "main" java.lang.IllegalArgumentException: node to traverse cannot be null!
at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:31)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:254)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
How should do ... ?
Use function as indicated
here ?
Help / Hints / indications are appreciated ...
\T,