PL/SQL“在 x 和 y 之间"不起作用,如果 y <X.为什么? [英] PL/SQL &quot;between x and y&quot; does not work, if y &lt; x. Why?

查看:24
本文介绍了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.为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆