I am writting an sql script to export the content of tables in csv files (one table per file). I managed to write a successful script, thanks to the spool function like this :
spool export.csv append
select 'fielda;fieldb;...' from dual
select fielda,fieldb,.... from table
spool off.
The first problem with this, is that I have to do a select from dual to get only the fields name on the first line.
The second problem with this, is that I have to write each field, and it becomes very painfull when you have 10 tables each having more than 20 fields. So my question was, is there any pl sql function, that takes in parameter only the table name, and export the full content in a csv file.
Thanks in advance.