Adding to Ravindra's reply:
If you are looking to export data into CSV, once you are able to load the data into a physical table then you can use the below code to export it into CSV,
DROP PROCEDURE EXPORTTABLE; CREATE PROCEDURE EXPORTTABLE AS BEGIN DECLARE QUERY VARCHAR(100); QUERY := 'EXPORT "BEST"."NEW_EMPLOYEE" AS CSV INTO ''/tmp'' WITH REPLACE SCRAMBLE THREADS 10'; EXEC (:QUERY); END; CALL EXPORTTABLE;
See my reply in this thread:
Regards,
Krishna Tangudu