$ 0 0 A SQL UDF is only allowed to perform an expression and return the result. A Select is not allowed in a SQL UDF.