Hi Guys!
I have a table that has the reasons for loosing a game. This table contains the following fields: ID, Reason.
Now, I'm trying to make a query (I will integrate it into an ETL procedure) that adds a CLASIFICATION. But this clasification is based on the reason. If the reason is Cold Bat or Bad Cold, the Clasification is Weather. If it's Lack of Uniform, the Clasification is Voluntary. And so on.
So far, this is the query I got.
But I get a missing keyword error. Can you guys help? Should I use Decode instead of Case? If I do, how do I integrate the Like into the Decode? Considering that not all the Reasons have the same length, or "keywords" in the same place (taking reason cold bat and bad cold as an example).
Any help will be appreciated.
As usual, thanks a lot, guys!
![[gorgeous] [gorgeous] [gorgeous]](/data/assets/smilies/gorgeous.gif)
Issys Pouerie
Systems Support Analyst
San Juan, Puerto Rico
I have a table that has the reasons for loosing a game. This table contains the following fields: ID, Reason.
Code:
ID REASON
1 FRAUD
2 LACK OF UNIFORM
3 BAD HITTER
4 COLD BAT
5 BAD COLD
Now, I'm trying to make a query (I will integrate it into an ETL procedure) that adds a CLASIFICATION. But this clasification is based on the reason. If the reason is Cold Bat or Bad Cold, the Clasification is Weather. If it's Lack of Uniform, the Clasification is Voluntary. And so on.
So far, this is the query I got.
Code:
SELECT ID, REASON,
CASE WHEN REASON LIKE '%COLD%' THEN 'WEATHER' AS CLASIFICATION
FROM TABLE_A
ORDER BY ID(+)
But I get a missing keyword error. Can you guys help? Should I use Decode instead of Case? If I do, how do I integrate the Like into the Decode? Considering that not all the Reasons have the same length, or "keywords" in the same place (taking reason cold bat and bad cold as an example).
Any help will be appreciated.
As usual, thanks a lot, guys!
![[gorgeous] [gorgeous] [gorgeous]](/data/assets/smilies/gorgeous.gif)
Issys Pouerie
Systems Support Analyst
San Juan, Puerto Rico