Consider the Below Scenario -
I want to get the Result where it will display the maximum marks which the Student has got!
Result Would be-
I am using TD14.10 release and
SELECT GREATEST (50,100,70) throws an error in TERA Mode. The error I got was:
"SELECT Failed. 9881: Function 'greatest' called with an invalid number or type of parameters". However, when I tried
SELECT GREATEST(GREATEST(50,100),70), I did get the desired result. I was checking its syntax at info.teradata.com and found that it accepts two arguments.
Am I wrong here? Does it really accept more than two arguments.
td_sysfnlib.GREATEST accepts up to 10 parameters.
Check if there's another UDF with the same name in the search path:
default database -> syslib -> td_sysfnlib
I checked for any other UDF with the same name and I found just one function with this name.
I issued the folloing query to check if there are any other functions with the same name and I got one row in result:
SELECT DATABASENAME, TABLENAME, TABLEKIND FROM DBC.TABLESV
WHERE TABLENAME = 'GREATEST'
However, when I checked manually using Teradata Administrator, I found that inside SYSLIB database, there were 9 functions as shown below:
REPLACE FUNCTION SYSLIB.GREATEST
(str1 VARCHAR(512) CHARACTER SET LATIN,
str2 VARCHAR(512) CHARACTER SET LATIN)
RETURNS VARCHAR(512) CHARACTER SET LATIN
NO EXTERNAL DATA
PARAMETER STYLE SQL
CALLED ON NULL INPUT
EXTERNAL NAME 'CS!greatestcc!M:\DBAScripts\UDFs\oraudfs_v_4\grea
All functions have only two params, with multiple variations of (int, decimal), or, (decimal, int), or, (int, str), or, (str, int) and so on...
Could this be the reason that in my case, this function is accepting only two params?