Quote:
|
Originally Posted by kevinhurt
Everytime I try to create a UDF with recursion I get a SQL syntax error of -104 complaining about a "(" was encountered.
|
Although DB2 v8 for z/OS promises that "one can use a scalar fullselect wherever an expression is allowed", this is not the case for the return value of a UDF; e.g., the following simplified UDF creation statement gives a similar error:
Code:
CREATE FUNCTION TEST ()
RETURNS INT
DETERMINISTIC
RETURN (SELECT 5 FROM SYSIBM.SYSDUMMY1) ;
as opposed to the completely equivalent but accepted
Code:
CREATE FUNCTION TEST ()
RETURNS INT
DETERMINISTIC
RETURN 5 ;
In my case the error message is:
Code:
DSNT408I SQLCODE = -214, ERROR: AN EXPRESSION IN THE FOLLOWING POSITION, OR
STARTING WITH 0 IN THE RETURN CLAUSE IS NOT VALID.
REASON CODE = 7