-
1. Re: Creating userdefined data type in Teiid
shawkins Aug 31, 2010 10:27 AM (in response to rakeshsagar)Rakesh,
Depending on what you are trying to do, the simpliest approach is to just use the OBJECT type for the parameter.
Steve
-
2. Re: Creating userdefined data type in Teiid
rakeshsagar Sep 1, 2010 2:06 AM (in response to shawkins)Hi,
I am creating a procedure to which I want to pass the Java object as the parameter. This java object has some class variables which will be initialized before passing to the procedure and in the procedure I will retrieve the values and use them for some processing.
-
3. Re: Creating userdefined data type in Teiid
shawkins Sep 1, 2010 10:57 AM (in response to rakeshsagar)An OBJECT type would work fine. Adding a user defined type doesn't currently add much value since the runtime type system only understands built-in types.
Steve
-
4. Re: Creating userdefined data type in Teiid
miklboylen91 Oct 21, 2010 10:05 PM (in response to shawkins)I hope that this question is closely enough related to the original post, but here goes. One of the source databases we use is in PostgreSQL and it utilizes multi-valued fields (a lot - it's a conversion from a VERY legacy system which stores lists all over the place). Teiid does not appear to have an array data type (and thank heavens for that ...), but I'm wondering if it would be possible to do some type of transformation - possibly involving the Teiid Object data type - in which I can get Field(0).value, Field(1).value, Field(2).value, etc. transformed and mapped to more relational db-friendly datatype (like a concatenated large varchar field).
I'd appreciate any insight you may have.
Michael
-
5. Re: Creating userdefined data type in Teiid
rareddy Oct 21, 2010 10:28 PM (in response to miklboylen91)Michael,
You can read about UDF here http://docs.jboss.org/teiid/7.1.0.Final/developer-guide/en-US/html_single/#udfs
Yes, you can accomplish the scenario you described. Use the Designer and import the data from PG, and make sure the column is modeled as Object, and then create the UDF model, and Function that takes Object as in and string as out. Then provide the Java implementation of the function you created and deploy them all. Once you write the function, you can use it in your client SQL code, or you can also use the function inside any Teiid base table transformations or virtual procedures.
Hope this helps.
Ramesh..