title: Oracle: DECODE and WHERE Clause
body: <p>So I've been trying to deal with a poorly optimized/created database. I know you can use decode within a where clause, but I was wondering if there was any way you could use the value in the where clause after decoding in the selection. Basically, I have a case sorta like this</p>
  
  <pre><code>DECODE(theRow, 'P', 1,'D',2,'T',3, ... (goes on a bit)) AS theRowDecoded
  </code></pre>
  
  <p>And I want to select the values between what might be sent in for that row (so say between 5 and 8). Not sure why they didn't just use numbers for this column in the database (would make way more sense and easier programmatically), but oh well, gotta work with what I have. </p>
  
  <p>So is there any way to use theRowDecoded in where or is there a better way to do a range? I know that DECODE is only an equals, but hoping there's a good way to do a range with decode.</p>