create or replace FUNCTION FACTORIAL ( n IN NUMBER ) RETURN NUMBER IS val NUMBER :=1; tem number :=n; BEGIN while tem>1 LOOP val:=val*tem; tem:=tem-1; END LOOP; RETURN val; END FACTORIAL;
I create a function like this.
And I test it in sql developer(ctrl-F10), and get the right result.
When I use the function in SQL: select factorial(10) from dual; (I use log as function owner, exactly same connection as I test the function with ctrl-F10)
cames the error message:
[TimesTen][TimesTen 184.108.40.206.0 ODBC Driver][TimesTen]TT2818: Unknown function FACTORIAL. If this is a PLSQL function note that such functions are not yet supported in SQL statements. -- file "saCanon.c", lineno 24079, procedure "inferExprTNFunc()"
Does that means timesten doesn't support user defined function in SQL statements?