Oracle ORA-00936 Missing Expression Error with Subquery
<p>I have a working query that connects to a remote Oracle database through the Oracle 11g Client.  To incorporate a parameter based on an alias I used this query as a subquery with the parameter in the main query.  I don't see anything the matter - though something obviously is - so before I grind on this for another hour I thought I would pose the code to the experts:</p>

<pre><code>SELECT *
FROM
  (
  SELECT "UNITS"."UnitNumber", "UNITS"."ModelYear", "UNITS"."Make", "UNITS"."Model", "UNITS"."Class3", 
    "UNITS"."Class3Description", "UNITS"."TechnicalSpecification", SUBSTR("UNITS"."TechnicalSpecification", 13, 1) AS "FSC",
    "UNITS"."OwnerDepartment", "UNITS"."UnitStatus",
    CASE WHEN "UNITS"."Class3" = '1' AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'F' THEN 'Y'
      WHEN ("UNITS"."Class3" = '10' OR "UNITS"."Class3" = '15') AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'U' THEN 'Y'
      WHEN "UNITS"."Class3" = '11' AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'D' THEN 'Y'
      WHEN ("UNITS"."Class3" = '2' OR "UNITS"."Class3" = '8' OR "UNITS"."Class3" = '18') AND 
    SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'C' THEN 'Y'
      WHEN ("UNITS"."Class3" = '3' OR "UNITS"."Class3" = '9' OR "UNITS"."Class3" = '17') AND 
    SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'B' THEN 'Y'
      WHEN "UNITS"."Class3" = '16' AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'S' THEN 'Y'
      WHEN ("UNITS"."Class3" = '13' OR "UNITS"."Class3" = '4') AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'L' THEN 'Y'
      WHEN ("UNITS"."Class3" = '12' OR "UNITS"."Class3" = '14') AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'G' THEN 'Y'
      WHEN ("UNITS"."Class3" = '19' OR "UNITS"."Class3" = '20') AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'R' THEN 'Y'
      WHEN "UNITS"."Class3" = '5' AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'E' THEN 'Y'
      WHEN "UNITS"."Class3" = '6' AND SUBSTR("UNITS"."TechnicalSpecification", 13, 1) &lt;&gt; 'H' THEN 'Y'
      ELSE ''
      END AS "MISMATCH"
  FROM "MFIVE"."VIEW_ALL_UNITS" "UNITS"
  WHERE  "UNITS"."OwnerDepartment" LIKE '580' AND "UNITS"."UnitStatus"='A'
  ) "U"
WHERE  "U"."MISMATCH" = {?Mismatch}
ORDER BY "U"."UnitNumber"
</code></pre>

<p>When I attempt to run this query I recieve a "Failed to retrieve date from the database" error, ORA-00936: missing expression.</p>

<p>For the life of me I can't see what the problem is.  Any assistance will be appreciated.</p>