Try OpenEdge Now
skip to main content
SQL Development
User Defined Functions : Working with User Defined Functions : UDF Example
 

UDF Example

TRIM - In the scenario where the user is working with a SUBSTR for varchar columns like tenantname_tbl() with the character length of 32k, it becomes difficult to read the data. The Trim function helps the user by providing the users with the exact data that is needed. The TRIM function could be written as shown below:

CREATE function TRIM(col varchar(60))
return varchar(32)
import
import java.io.*;
begin
return col.trim();
end

This function can be called as shown below to get the data after the TRIM function is performed:

SELECT distinct TRIM(tenantname_tbl(pub.mtCustomer)) from pub.mtCustomer;
TRIM(tenantName_tbl(MTCUSTOMER))
--------------------------------
OEDProducts
SNCSoftware