PL/SQL“在 x 和 y 之间"不起作用,如果 y <X.为什么?

2021-12-24 00:00:00 oracle plsql

我有一个 PL/SQL 代码,例如:

I have a PL/SQL code like:

case when column between 201203 and 201201
then other_column
end

我知道列中有 201203 的值.所以代码应该返回一些值.但直到我更正后才这样:

I know that there are values in column that are 201203. So code should return some values. But it didn't until I corrected it like:

case when column between 201201 and 201203
then other_column
end

为什么关键字之间会这样?它是如何在 Oracle 数据库上实现的?

Why between keyword works like that? How it is implemented on Oracle Databases?

推荐答案

这是 ANSI SQL 行为.

This is ANSI SQL behavior.

 expr1 BETWEEN expr2 AND expr3

翻译成

 expr2 <= expr1 AND expr1 <= expr3

相关文章