First, I don't know Toad Freeware.
So, if the error was related to Toad environment, I can't help you.
When did you recieved the error SQL0390N?
If it was the time you executed it, how did you invoked the function?
What DB2 version(and platform OS) are you using?
Here is an example of table function tested on Command Editor.
Code:
------------------------------ Commands Entered ------------------------------
connect to SAMPLE ;
------------------------------------------------------------------------------
Database Connection Information
Database server = DB2/NT 9.7.2
SQL authorization ID = DB2ADMIN
Local database alias = SAMPLE
A JDBC connection to the target has succeeded.
------------------------------ Commands Entered ------------------------------
CREATE FUNCTION test_emp()
RETURNS TABLE(empid INTEGER)
LANGUAGE SQL
RETURN SELECT INT(empno) FROM employee WHERE workdept = 'E11'
;
------------------------------------------------------------------------------
DB20000I The SQL command completed successfully.
------------------------------ Commands Entered ------------------------------
SELECT *
FROM TABLE( test_emp() );
------------------------------------------------------------------------------
EMPID
-----------
310
280
90
300
290
5 record(s) selected.