0 - 50 of 70 tags for udf


Hi, I am trying to create my first function in Teradata SQL Assistant using a script I found on the internet.  the purpose of the function is to convert a timestamp to a unix timestamp and is as follows;

I have a query using OREPLACE that runs in one environment, but fails in another with:

Executed as Single statement.  Failed [7509 : HY000] Result Exceeded maximum length for UDF/XSP/UDM pm_edw_etl_load.oreplace2. 
Elapsed time = 00:00:00.437 
STATEMENT 1: SEL  failed. 


Is there a database where we can create user defined functions so that it is not necessary to qualify them with the databasename when we use them.  The UDFs that have been created by the Teradata installation are all in the TD_SYSFNLIB database, and don't need to be prefixed with the databasename.

Teradata Debugger for C/C++ UDF Eclipse Plug-in Release 15.10.01 has been released and is available in the Teradata Developer Exchange download section at Teradata Debugger for C/C++ UDF .

The Teradata Debugger for C/C++ UDF (CUDB) Eclipse Plug-in provides a Graphical User Interface for CUDB on the Eclipse IDE.


I can't find a library listing of INMODs or UDFs anywhere on here.
I'm sure someone has written some of these to parse out binary data into CHARacter strings.  How do I find them?


This article is a follow on to article [1] which discussed implementing K-means using a Teradata release 14.10 table operator. The main contribution of this article is to discuss how to use the new Teradata 15.0 multiple input stream feature and a short discussion on a gcc compiler performance optimization.

I want to write SQL UDF with Multiple Lines:
1. Declare variables.
2. Set those variables with select into statement.
3. some if conditions on Variables
4. return some value.
What is the syntax to write this.
I'm using teradata Version

We have the next SQL file:
CALL SQLJ.INSTALL_JAR('CJ!/home/tdatuser/java/Parser.zip','UA_Jar',0);
CREATE FUNCTION ua_family (agentString CHAR(30))

Hi experts
I am  developing a table operator UDF using C/C++ . Teradata release is .

How does TASM enforce rules such as classification and workload exceptions against User Defined Functions?  What about table functions and table operators, some of which do their work outside of Teradata?  How far can you rely on TASM classifications using estimated processing time in these cases?  Will there be accurate resource usage numbers reported to support workload exceptions on CPU or I/O?

These are some of the questions that need answering if you are extending the use of simple or more complex user-defined functions on your platform.

1)There are certain UDFs cretaed in my Prod Teradata system.I am trying to grant "EXECUTE FUNCTION" on the UDFs to users.

Hi there,
I need to create a UDF in C to connect to a teradata server dynamically....can this be written using the ODBC API and then integrate this function into the teradata dictionary or will I have to use CLI to do this task?????

I have a java udf that basically just does a bunch of shows on each and every procedure and macro and then inserts those into a table. The jar is installed and my definition for the procedure is below. The problem i'm getting is i keep getting the error:

Hi Guys,
I need to create a function that reads its result from a table, so I need to use a SELECT statement to read the output. Something like that:

While compiling UDF in Teradata, We place the .c program of the function in a folder and compile the function structure in Teradata specifying the file path in the EXTERNAL NAME part.
How do we compile an UDF if we are given the object file (.o extn) of the function only?
Appreciate your help!!

has anybody implemented the Vincenty algorithm for great circle distance calculation as a UDF
and would be willing to share it? (I know there are downloadable GCD UDFs around, but the
requirement at hand is to implement the Vincenty algorithm).

Hi all,
I just released SHA-2 UDFs (SHA-256/512) to GitHub.
-- Akira Kuroda

User-Defined Functions

This feature was introduced in Teradata Database V2R5.1.

We need to make UDP connections from Java UDF functions to run some external processing. This processing is multithreaded and we can serve up to 100 concurrent requests.
The problem we experience is that the Teradata server does not open more than 2 UDP/IP connections at any one time. 

I can retrieve the C source code of UDFs by using SHOW FUNCTION (in SQL Assistant as well as in BTEQ).
But this only works for UDFs that I have created myself. For UDFs created by others, I only get back the REPLACE FUNCTION statement, but no source code.

I need to store the value in the DataParcel column(which is of VARBYTE datatype) in the first error table of FASTLOAD into a permanent teradata table but with a proper format(The ddl of this table will be exactly the same as the target table, except that all datatypes are varchar)
I know this as a potential solution/*From teradata manual*/:

We have a basic (test) ALC UDF (actually it is just a dummy), and it works.
But we are not able to return with -1 to indicate that we cannot compress the value, because it returns with:
INSERT Failed. 7509: Result Exceeded maximum length for UDF/XSP/UDM SYSUDTLIB.alc1_num.
void alc1_num(   VARCHAR_LATIN *inStr,

SQL provides a set of useful functions, but they might not satisfy all of the particular requirements you have to process your data.

User-defined functions (UDFs) allow you to extend SQL by writing your own functions in the C/C++ programming languages, installing them on the database, and then using them like standard SQL functions.

Customers are currently leveraging Teradata's features such as User Defined Functions (UDFs) and External Stored Procedures (XSPs) to develop complex applications.

The aim of this set articles is to show the user how to use the Eclipse IDE to debug in a single-node, controlled, non-production environment:

  • Java or C/C++ User Defined Functions (UDFs)
  • Java or C/C++ External Stored Procedures (XSPs)

The audience for this set of articles ranges from Teradata associates within the R&D and Professional Services organizations to  Teradata Customer and Partner developers who want to debug a UDF/XSP running on their  DBS VM before installing it on a production system.

SQL provides a set of useful functions, but they might not satisfy all of the particular requirements you have to process your data.

User-defined functions (UDFs) allow you to extend SQL by writing your own functions in the C/C++ programming languages, installing them on the database, and then using them like standard SQL functions.

SQL provides a set of useful functions, but they might not satisfy all of the particular requirements you have to process your data.

User-defined functions (UDFs) allow you to extend SQL by writing your own functions in the Java programming language, installing them on the database, and then using them like standard SQL functions.

SQL provides a set of useful functions, but they might not satisfy all of the particular requirements you have to process your data.

User-defined functions (UDFs) allow you to extend SQL by writing your own functions in the Java programming language, installing them on the database, and then using them like standard SQL functions.

Hi, I'm looking for an external UDF that will emulate the strtok function in C.  I'm aware that it is available as an internal function on TD14, but our client is running 13.10.  I am using it in a recursive query to denormalize a view, so i need a scalar UDF that will return a single value result.  Thanks!

An integrated development environment is crucial to software developers for editing, building and debugging their program all within one environment. Therefore, setting up the right development environment is an important first task.

 I am using OTRANSLATE UDF to remove control characters.I am using it in the following format

It is the Big Data era. But we do not have enough "big applications". 

This tool - 'Common UDF' - provides a code builder for both Teradata table UDF and Hadoop Pipes UDF based on the same core code. In this way, we can implement applications for both Teradata and Hadoop with the same code.

Download cmudf.zip (7Kb)

This topic will be disucssed at Teradata PARTNERS 2012, Session ID 1987 - Common UDF cross Hadoop and Teradata – One Software for Two Platforms. Please join us at this session to learn more.

How to do casting in Userdefined function?


We are developing some user defined functions (aggregates, window aggregates) and table functions  in TD 12.0.  

We tried to use the example from the "SQL External Routine Programming" book.  Unfortunately, the releasea listed on this book is 13.10.


Are there any doc's which discuss SQL UDF's?  (Especially the various qualifiers in the CREATE FUNCTION statement).  I am trying to determine why my regular SQL works as expected, but when you put the same code into an SQL UDF, it returns unexpected results.  Any insight would be greatly appreciated.

So you are testing or developing in a Teradata Express 13 or a general Teradata environment and you are anxious to integrate your Java code into your Teradata DB using Java UDF extensibility...just to find yourself in an errors-headache with things like:

- 7583 The secure mode processes had a set up error

As I qualified in a previous post, I'm a Teradata newbie (migrating from Oracle).   Just started writing UDF's.  I see the following Warning in the UDF Programming manual and wanted to understand this in more detail.  There are also some additional comments in the same doc section referring to core dumps, and where they are stored. 



,i write a AGGREGATE udf and compile it  to database,but report error when execute it :

Teradata Database] [TeraJDBC] [Error 7502] [SQLState HY000] A system trap was caused by UDF/XSP/UDM FW.group_concat for SIGSEGV

does someone can help me ?


this is my code:


I'm working on creating my UDF for Teradata. Before deploying my UDF, I would like to check whether a UDF with the same name exists or not in Teradata. In which table/view does Teradata keep UDF descriptions?

It seems Teradata store UDF list for each database. Is there a way to create a UDF that shared among all databases?

As most of you might agree, managing our collections of digitial pictures is becoming quite a challenge.  The number of photos continues to increase and now includes pictures from cameras as well as multiple mobile devices.  And to add to my troubles, I find that I have duplicate copies in different folders and on different computers.  Getting this organized is becoming a high priority.  Sure there are management solutions already available, but hey, we're tech people and it's more fun to try to build our own!  With the free Teradata Express database and some java coding, we have the right tools to get started.


I am trying to use the Oracle UDFs provided by teradata in my TPT script. The problem I am facing is with the use of single quotes " ' " inside my insert part of my apply.

since the INSERT statement within the APPLY has to be contained within " ' "(single quotes) I cannot use the "nvl" udf that requires the replacement string to be in " ' ".

Example: 'Insert into table1 values ( nvl(:column, 'replacement string'));'

If anyone knows the escape character that may be used to escape the " ' " enclosing the "replacement string" then please help me.

Teradata 13.10 continues the strategy of delivering features that enable extending the Enterprise Data Warehouse functionality. SQL Language User Defined Function (UDFs) allows function to be implemented in SQL which is a natural fit for SQL writers. This session describes the feature and use cases. It also describes other enhancements in Teradata13.10 which includes User Defined Ordered Analytic Functions and new system functions for BIT, string and numeric processing.


Anyone ever tried to run FULL PUSHDOWN on informatica 8.6.1 with UDFs? I'm thinking about implementing of historization of data in C ;)


I've created four UDFs to handle data transformation from MAINFRAME source files. Originally the data type for all UDFs was to be fixed as VARCHAR, however after careful investigation of source data by one of my colleagues, two of the functions needed to be overloaded to accept both VARCHAR and VARBYTE, and the remaining two UDFs required both VARCHAR and DECIMAL.

I'm running a DROP statement for all UDFs before running a REPLACE FUNCTION statement, however I encounter the following problem (extract from log file; have used <**> to mask database name):

One of the biggest benefits of Query Banding is the ability to pass parameters into an SQL script.

Establishing an associative security table lookup between a userid and allowable company codes may allow easy access to the base data tables.  

Is there an equivalent to user defined function (MS SQL) in teradata where I can write SQL that returns either a scaler or table which I can further use in a query.

For example:

SELECT sclfunctionName(param1, param2)


SELECT * from tblfunctionName(param1, param2)

Both sclfunctionName and tblfunctionName contain some SQL.

I have tried it using a MACRO but don't know how I can use it in SELECT

CREATE MACRO tstMacro (param1 VARCHAR(10))
SELECT fld1, fld2, fldm FROM tbl WHERE fldm = :param1;
-- my query is really long just a small one for example


Hi all,

Hope all is well.

I wanted to know if we can pass each row of the syslib.MonitorSession(-1,'*',0) resultset to syslib.MonitorSQLCurrentStep so that I can get each session and its number of steps and its current active step.