title: Writing a select statement inside an Oracle user-defined function
body: <p>I'm quite new to Oracle SQL (though I've written a fair bit of SQL) and am having trouble embedding a simple SELECT statement in a function.  It feels like SQL ABC but I can't seem to get it :(</p>
  
  <p>I <em>think</em> I'm using PL-SQL</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>create or replace FUNCTION GET_GROUP_BY_ID RETURN VARCHAR2
  AS my_result
  BEGIN
  
    SELECT fav_group.name 
      INTO my_result 
      FROM fav_group 
     WHERE fav_group.id = 12345
  
    RETURN my_result;
  
  END GET_GROUP_BY_ID;
  </code></pre>
  
  <p>As I said, I've tried a LOT of variations on the above code by looking at code examples on google but can't seem to get it right.</p>