3 Replies Latest reply on Aug 8, 2016 7:34 PM by shawkins

    Teiid user defined Functions

    hend.amin

      Hello

       

      I need an example on Function creation in the VDB. the function is totally SQL. That takes on parameter Number and returns a string representation for that number (Item ID and returns Item name).

      I have created procedures but i need to create functions as well.

       

      Thanks

        • 1. Re: Teiid user defined Functions
          shawkins

          Using DDL this it looks like DDL Metadata · Teiid Documentation:

           

          CREATE VIRTUAL FUNCTION func(p1 bigdecimal) RETURNS integer as return <some expression>;

           

          This is not yet supported in Teiid Designer.

           

          A possible drawback is that currently a sql defined function is not inlined, which may inhibit pushdown if the sources aren't marked as supporting the function.

          • 2. Re: Teiid user defined Functions
            hend.amin

            Hello Stevens,

             

            I want to use this in my sql query for the VDB to avoid code repetition.

             

            select getname(Id) from table;

             

            How can i make that work? is there a possible way to make it work this way or i should wait for a fix in a future release ??

             

            Thanks

            • 3. Re: Teiid user defined Functions
              shawkins

              > How can i make that work?

               

              To clarify are you using Teiid Designer or a VDB that defines it's metadata through import / ddl?  And do you want getname to pushdown to the source or just be able to be evaluated in Teiid?