title: PL/SQL Return ROWTYPE from Function
body: <p>I am trying to write a function that returns a ROWTYPE, but it should only return one record.</p>
  
  <p>Here is my function:</p>
  
  <pre><code>FUNCTION f_get_lastest_by_id (p_id IN T_PERSON_ATTRIBUTE.ID%TYPE)
        RETURN T_PERSON_ATTRIBUTE%ROWTYPE
     IS
        out_rec   T_PERSON_ATTRIBUTE%ROWTYPE;
     BEGIN
          SELECT *
            INTO out_rec
            FROM T_PERSON_ATTRIBUTE
           WHERE ID = p_id
        ORDER BY EFFECTIVE_DATE DESC
        OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY;
  
        RETURN out_rec;
     END;
  </code></pre>
  
  <p>I've also tried</p>
  
  <pre><code>FUNCTION f_get_lastest_by_id (p_id IN T_PERSON_ATTRIBUTE.ID%TYPE)
        RETURN T_PERSON_ATTRIBUTE%ROWTYPE
     IS
        out_rec   T_PERSON_ATTRIBUTE%ROWTYPE;
     BEGIN
          SELECT *
            INTO out_rec
            FROM T_PERSON_ATTRIBUTE
           WHERE ID = p_id
        ORDER BY EFFECTIVE_DATE DESC
        LIMIT 1;
  
        RETURN out_rec;
     END;
  </code></pre>
  
  <p>Non of which will compile.</p>