Make sure that the user running the procedure can run the underlying query. You can also just return a blob or clob.