DB2 requires an ending delimiter when compiling user defined functions or stored procedures from the command line.
Workbench does not have this requirement.
To compile a procedure or function, there is no need to use a delimiter such as the default '@'.
1) Write the code without an ending delimiter and choose 'Execute as single Batch' (CTRL+F5)
Change the current query options to Query kind: SP/Function: