SQL> select test_func(39757) from dual;
You seem to be testing from SQL*Plus... You need to invoke the PL/SQL engine from SQL*Plus, so try something like:
set serveroutput on;
result := test_func(39757);
dbms_output.put_line('result = ' || result);
Don't forget the slash at the end, it is very important; also, dbms_output.put_line accepts no more than 255 characters, so if your result variable is longer than that you'll get an error. On Tom Kyte's site
you can find alternative procedures that allow you to print more than 255 characters on the dbms_output buffer.