'How to use a SQL inside Teradata UDF?

I want to convert a complex query into a reusable and parameterized function. Thus I am trying to create an UDF in Teradata, but do not understand how to use SQL inside my UDF.

Below is the sample UDF from Oracle database. Can anyone please confirm if & how I can create similar in Teradata ?


   CREATE FUNCTION test_ak (a IN NUMBER) 
   RETURN NUMBER 
   IS b NUMBER(10);
   BEGIN       
          SELECT a+1      
          INTO b
          FROM dual ;     
     RETURN(b);
   END;
   /


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source