otranslate function handling string size limit

Analytics
Enthusiast

otranslate function handling string size limit

Hello,

 

I am using function 'otranslate' to count the number of commas in a string. The string has 600+ characters, when I applied OTRANSLATE(mystring, ',','') on it, I found that the result returned is not complete. It seems that the OTRANSLATE only functions on the first 400 + characters, which is wierd.

 

I found that there are similar questions in forum but no clear anwers yet. Can anyone throw a light?

 

Lorraine


Accepted Solutions
Senior Apprentice

Re: otranslate function handling string size limit

OTranslate returns a VarChar(8000), if TYPE(OTRANSLATE(mystring, ',','')) returns something else there must be another UDF with the same name.

You can check for existing UDFs using

SELECT * FROM dbc.FunctionsV
WHERE FunctionName = 'oTranslate'

The builtin is stored in td_sysfnlib.

1 ACCEPTED SOLUTION
3 REPLIES
Enthusiast

Re: otranslate function handling string size limit

Though I found that I can use function 'REGEXP_REPLACE' to achieve the same goal, but I'm still curious of the string size limit for 'Otranslate'.

Senior Apprentice

Re: otranslate function handling string size limit

OTranslate returns a VarChar(8000), if TYPE(OTRANSLATE(mystring, ',','')) returns something else there must be another UDF with the same name.

You can check for existing UDFs using

SELECT * FROM dbc.FunctionsV
WHERE FunctionName = 'oTranslate'

The builtin is stored in td_sysfnlib.

Enthusiast

Re: otranslate function handling string size limit

Thanks Dieter! I ran your code and there are indeed two functions names 'otranslate'. When I specify the database name and use TD_SYSFNLIB.OTRANSLATE(item_list, ',',''), the result returned is correct :)