質問

I have a view in APEX which I want to export to the drive as a CSV file (which would be picked up by processes from other applications). There is the UTIL_FILE method but it seems much more complex. How can I use SPOOL to export a view as a CSV? I tried this, but it failed to run inside of Apex? So I guess I am not sure about the script itself, but also where to save/schedule it.

spool out.csv
select '"'|| EVENT_ID || '",' || ENTER_DATE || ',' || START_TIME || ',' || END_TIME || ',' || PLANNED_FLAG || ',' || PURPOSE
 || ',' || TITLE || ',' || SERVICES || ',' || CAUSES || ',' || TICKET_NUM || ',' || OWNER || ',' || DETAILS from DT_FULLVIEW;
spool off
exit​
役に立ちましたか?

解決

There are a couple of ways to do this.

1) You can create your script and schedule it to run using SQLPLUS outside of the database using the operating system utilities.

2) dbms_scheduler is said to be able to run external programs. (I have never done this myself).

3) Create a packaged procedure that creates the file using utl_file_dir and schedule it from within the database.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top