Thanks for the reply Louis Moreaux ! I forgot about that function. But in the meantime, I've solved it using a custom AJAX callback with APEX_DATA_EXPORT.DOWNLOAD that get's called via APEX_PAGE.GET_URL(P_REQUEST => 'APPLICATION_PROCESS=... syntax from my SQL query. Works like a charm :)