title: How do I write a table valued function in Teradata?
body: <p>So, I'm trying to write a table valued function in Teradata with a SQL function, but I'm having a hard time figuring out the syntax, or if it's even possible. I've gotten a scalar value function to work, and I've seen examples of table-valued function is C-UDFs, but not any for SQL-UDFs.</p>
  
  <pre><code>REPLACE FUNCTION APP.STAMPLE (
      "a" INTEGER,
      "b" INTEGER)
      RETURNS TABLE
      VARYING COLUMNS(2)
      LANGUAGE SQL
      CONTAINS SQL
      NOT DETERMINISTIC
      CALLED ON NULL INPUT
      SQL SECURITY DEFINER
      COLLATION INVOKER
      RETURN SELECT (A + B as val, 'A' as funct)
  END;
  </code></pre>