Redian新闻
>
In SQL, is it possoble to define my own comparison function
avatar
In SQL, is it possoble to define my own comparison function# Database - 数据库
D*h
1
For example, for tables A, B with Name, ID
I want to
select A.Name
from A, B
where A.Name = B.Name
but here the = is not strict equal. They are seen to be equal if these two
strings A.Name and B.Name are different with at most 1 character. For
example, 'John' and 'Johnn' are equal.
Is there any way to define a function to deal with this? Can I define a
function else where to define this equal, than then use it after "where"?
Thanks
avatar
i*a
2
you can create a function that returns a table of results. but you cannot
overload an operator like "=", nor existing function

two
"where"?

【在 D***h 的大作中提到】
: For example, for tables A, B with Name, ID
: I want to
: select A.Name
: from A, B
: where A.Name = B.Name
: but here the = is not strict equal. They are seen to be equal if these two
: strings A.Name and B.Name are different with at most 1 character. For
: example, 'John' and 'Johnn' are equal.
: Is there any way to define a function to deal with this? Can I define a
: function else where to define this equal, than then use it after "where"?

avatar
B*g
3
if oracle 10g2+, try UTL_MATCH.EDIT_DISTANCE

【在 D***h 的大作中提到】
: For example, for tables A, B with Name, ID
: I want to
: select A.Name
: from A, B
: where A.Name = B.Name
: but here the = is not strict equal. They are seen to be equal if these two
: strings A.Name and B.Name are different with at most 1 character. For
: example, 'John' and 'Johnn' are equal.
: Is there any way to define a function to deal with this? Can I define a
: function else where to define this equal, than then use it after "where"?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。