【问题标题】:PLSQL - Comparison operator in selectPLSQL - 选择中的比较运算符
【发布时间】:2021-03-27 00:29:21
【问题描述】:

如何在选择中使用比较操作 即

从对偶中选择 1=2;

期待一个布尔结果

这个请求给了我一个错误 00923. 00000 - “在预期的地方找不到 FROM 关键字”

【问题讨论】:

  • 这能回答你的问题吗? How to use BOOLEAN type in SELECT statement
  • 不行,我不能添加函数也不能用例
  • 我不能添加函数也不能用例,为什么?你能用什么?您期望的布尔结果是什么 - 字符串 'FALSE' 或其他?

标签: plsql operator-keyword


【解决方案1】:

是的,您可以在需要布尔值的子句中使用比较运算符,例如WHEREHAVING

不使用函数和case 运算符的可重现示例:

select (
    select 'true'  from dual where 1=2 union all
    select 'false' from dual
    order by 1 desc fetch first row only) "boolresult"
from dual
/

boolresult
----------------
false 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-13
    • 2019-08-13
    相关资源
    最近更新 更多