Alex
Alex

Reputation: 13

SQL CASE statements and MINUS

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 present in the CASE results, be fouling things up?

Upvotes: 1

Views: 1759

Answers (1)

yulkes
yulkes

Reputation: 210

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.

Upvotes: 1

Related Questions