[英]Operator 'is true' for type 'long' not found for oracle sql query
我試圖運行這個邏輯,我得到 output 如下,
我獲取以下 output 字段的代碼如下所示
select max(dtm) over (partition by name ,id )-current_date from mm
output
-4168
-4168
-4168
-4127
我想要的是與“case when”語句一起運行這個邏輯,所以我嘗試了:
case when max(dtm) over (partition by name ,id )-current_date then 'yes'
else 'No' end as output
from mm
但我收到如下錯誤,不知道這個邏輯出了什么問題。
Operator 'is true' for type 'long' not found
CASE表達式有兩個forms。 一種稱為簡單案例表達式,另一種稱為搜索案例表達式。 您問題中的 SQL 使用后者,即searched case expression 。 我相信你可能需要簡單的案例表達,即
select case max(dtm) over (partition by name ,id ) - current_date
when -4168 then 'Yes'
else 'No'
end as answer
from mm
select
case when current_date-max(dtm) over (partition by name ,id ) < 30 then 'yes'
else 'No' end as 'output'
from mm
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.