title: How to write SQL statements in SAP HANA Scalar User Defined Functions (UDF)?
body: <p>I am writing a UDF (User Defined Function) in SAP HANA. I want to use this function in another SQL statement outside. </p>
  
  <p>Example:</p>
  
  <p>I want to write a UDF like </p>
  
  <pre><code>func_get_age (in_employee_id)
  </code></pre>
  
  <p>This function takes in in_employee_id as an input parameter. Inside the UDF, it performs a lookup on a table for the particular in_employee_id and returns the age. So, a SQL goes inside the UDF. Something like </p>
  
  <pre><code>SELECT AGE FROM EMPLOYEE WHERE EMPLOYEE_ID = in_employee_id
  </code></pre>
  
  <p>Now this Age needs to be returned back as an output which is then consumed by another SQL. Something like </p>
  
  <pre><code>SELECT func_get_age(11234) from dummy;
  </code></pre>
  
  <p>My question is</p>
  
  <p><b>Is it possible to write SQL inside UDFs in SAP HANA? Again i want the UDF to return a single value rather than a Table. I am not looking for Table Functions.</b></p>