title: Oracle error - ORA-00907: missing right parenthesis
body: <p>I'm scratching my head over this Oracle error.  The following query works perfectly:</p>
  
  <pre><code>SELECT
     V.PROJECTID,
     (SELECT WM_CONCAT(DISTINCT NAME) 
     FROM TPM_TRAININGPLAN JOIN TPM_DELIVERYMETHODS USING (METHODID) 
     WHERE PROJECTID=V.PROJECTID 
     AND VERSIONID=V.VERSIONID) as Methods
  FROM TPM_PROJECTVERSION V
  </code></pre>
  
  <p>However, I want to return my concantonated list in alphabetical order because I'm picky like that.  You'd think I would do:</p>
  
  <pre><code>SELECT
     V.PROJECTID,
     (SELECT WM_CONCAT(DISTINCT NAME) 
       FROM TPM_TRAININGPLAN JOIN TPM_DELIVERYMETHODS USING (METHODID) 
       WHERE PROJECTID=V.PROJECTID 
       AND VERSIONID=V.VERSIONID ORDER BY NAME) as Methods
  FROM TPM_PROJECTVERSION V
  </code></pre>
  
  <p>However, when I try this I get the error:</p>
  
  <pre><code>[Error] Script lines: 15-19 ------------------------
  ORA-00907: missing right parenthesis
  </code></pre>
  
  <p>I can run the query in its own SELECT statement, like so:</p>
  
  <pre><code>SELECT WM_CONCAT(DISTINCT NAME) 
  FROM TPM_TRAININGPLAN JOIN TPM_DELIVERYMETHODS USING (METHODID) 
  WHERE PROJECTID=240 
  AND VERSIONID=1 
  ORDER BY NAME
  </code></pre>
  
  <p>And it runs fine.  My parenthesis are more balanced than a Cirque du Soleil troop.  Why the error?</p>