Export Data to a CSV File

In this blog we look at the PL/SQL packaged function export.orders, which exports sales order data from the database to a CSV file.

Click on the following link view the PL/SQL source code.

Export Package
PL/SQL Package: export

To export the order data:

  1. Start the Oracle SQL Developer application.

  2. Open the script export_orders.sql, in the demo sql folder.

  3. export_order.sql
  4. Click on the Run Script button.

  5. Select the connection demo_connect.

You should now see the following script output.

Export Script Output

A CSV file, with a name in the format orders_YYMMDD.csv, should have been created in the DATA_OUT directory.

Order CSV File

Open the CSV in Excel:

Orders in Excel

In the next blog post, we will look at some useful PL/SQL functions.

Previous Blog Next Blog