I have a custom function in oracle returning a number after deleting records. I could get a value in sql_plus such as
call my_function(4) into :out_number; <
If you are using EclipseLink you can use a StoredFunctionCall object to call a stored function such as this.
You could also define it as a named query using the @NamedStoredFunctionQuery.