如果两个值相等,如果它们可以是除以下之外的空值,是否有更好的比较方法?
a = b or (a is null and b is null)
You can:
a=b or coalesce(a,b) is null
You could also use nvl
, but that is a legacy function and coalesce
is quicker, since it stops at the first non-null
You can use DECODE(A,B,1) = 1
DECODE is irregular in its treatment of NULLs.
However I think the intention is unclear and prefer vol7ron's answer. Clarity over minimising typing !
您可以使用nvl将其包装并将其设置为您的集合中不期望的某个值:
NVL(a,0) = NVL(b,0)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.