title: Oracle SQL RETURN INTO Fails within CFQUERY (ORA-06550/PLS-00103)
body: <p>I'm trying to update a record at the same time I select it. In Oracle SQL Developer, the below query works. However, when I execute it from within a CFQUERY tag in ColdFusion, I get an error (see below). I found this stack overflow (<a href="https://stackoverflow.com/questions/4270818/ora-06550-and-pls-00103">ORA-06550 and PLS-00103</a>) but wasn't any help. </p>
  
  <p>Ideally, I'd also like to return the whole record, not just the ID of the affected record. So, I have two questions.</p>
  
  <ol>
  <li>Why is the below record failing from within a ColdFusion CFC's CFQUERY?</li>
  <li><p>How to I rewrite the query to return the affected record rather than just that record's id?</p>
  
  <pre><code>DECLARE
    record_id scpricequeue.scpricequeueid%TYPE;
  
  BEGIN
  update scpricequeue
  set islocked = 1, datelocked = sysdate
  where scpricequeueid = (
    select scpricequeueid
    from (
      select scpricequeueid
      from scpricequeue
      where islocked = 0 and completed = 0
      order by dateadded asc
    )
    where rownum &lt; = 1
  )
  RETURNING scpricequeueid INTO record_id;
  DBMS_OUTPUT.put_line('Locked Record: ' || record_id);
  
  END;
  </code></pre></li>
  </ol>
  
  <p>ERROR RECEIVED when executed as CFQUERY: </p>
  
  <pre><code>ORA-06550: line 1, column 8: PLS-00103: Encountered the symbol "" when
  expecting one of the following: begin function package pragma procedure
  subtype type use &lt;an identifier&gt; &lt;a double-quoted delimited-identifier&gt;
  form current cursor The symbol "" was ignored.*
  </code></pre>