title: Oracle - Function to return a query result based on parameter
body: <p>I am trying to write an Oracle PL/SQL function that will return the given status_id of an application so I can archive data to a history table if the status_type returned is a specific value.</p>
  
  <p>In the case of this example my status types are 'Approved', 'Pending' or 'Declined'</p>
  
  <p>I have so far written this function so that I can run the method in an IF statement to check the current status type before archiving data.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION get_status(curr_id NUMBER)
  RETURN VARCHAR2 AS this_type status_type;
  
  BEGIN
      SELECT status_type 
      INTO this_type
      FROM status
      WHERE status_id LIKE curr_id;
  
      RETURN this_type;
  END get_status;
  </code></pre>
  
  <p>And although it compiles I receive an error telling me that my PL/SQL statement has been ignored.<br>
  I am fairly new to Oracle so I am probably missing something straightforward here, could anyone give me any pointers as to where I am going wrong with my code?</p>
  
  <p>Thanks in advance,
  Alex.</p>