使用 DEFAULT 关键字后面跟一个表达式自动参数的缺省值。如果为参数提供缺省值,并且以少于 UDR 定义的参量来调用这个 UDR 时,就是要缺省值。如果不为参数提供缺省值,并且以少于 UDR 定义的参数来调用这个 UDR 时,调用应用程序会收到错误。
CREATE FUNCTION square_w_default (i INT DEFAULT 0) {Specifies default value of i} RETURNING INT; {Specifies return of INT value} DEFINE j INT; {Defines routine variable j} LET j = i * i; {Finds square of i and assigns it to j} RETURN j; {Returns value of j to calling module} END FUNCTION;