Can you help me write a procedure in Oracle to spool data from a table to a CSV file?
问题 I am writing a procedure to create a CSV file with the data in an Oracle table. I used "spool filename;" but an error is coming. Can I use spool in PL/SQL? 回答1: I think that there are better ways to implement this on Oracle 10g/11g, but this should work fine on Oracle 9i or higher: CREATE OR REPLACE PROCEDURE prc_file_mult_column_generate( p_file_dir VARCHAR2, -- mandatory (Oracle directory name) p_file_name VARCHAR2, -- mandatory p_sql_query VARCHAR2, -- Multiple column SQL SELECT statement