开发者

SQL CASE statements and MINUS

开发者 https://www.devze.com 2023-01-24 14:27 出处:网络
Is there something about CASE statements that automatically breaks a query that uses MINUS? I\'m comparing a live pull of a data set to a previous cache of it, and even though the CASE statements in t

Is there something about CASE statements that automatically breaks a query that uses MINUS? I'm comparing a live pull of a data set to a previous cache of it, and even though the CASE statements in the live pull return pure VARCHAR2 results, I get a type mismatch between them and the static values in the cache table, which are stored as VARCHAR2 as well.

The only other possibilities I can think of are even less likely - could concatenations ( || ) or literals in single quotes, both of which are pres开发者_运维知识库ent in the CASE results, be fouling things up?


In your SELECT statement, do you have any more fields except this CASE? MINUS tries to compare the entire rows, maybe some of the other values aren't matching.

Did you try trimming the case ( TRIM(CASE foo WHEN.. ) to see if you slipped anything?

Are all the branches returning VARCHAR2? Sometimes, even if one branch returns a number or a date, it could mess up the types.

0

精彩评论

暂无评论...
验证码 换一张
取 消