PL/SQL quot;between x and yquot; does not work, if y lt; x. Why?(PL/SQL“在 x 和 y 之间不起作用,如果 y X.为什么?)
问题描述
我有一个 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
这篇关于PL/SQL“在 x 和 y 之间"不起作用,如果 y <X.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PL/SQL“在 x 和 y 之间"不起作用,如果 y <X.为什么?


基础教程推荐
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01