Using Toad Automation Designer to execute a loop and write to multiple files

I have a table which maps package names to a huge clob. The huge clob is basically a bunch of XML which I want to export as a txt file.

Currently, I can go into the automater and write a query like this:

SELECT *
FROM [table name]
WHERE PackageName = [Choose a package name]

Is there a way for me to use the automater to loop through every package name, and write each to a different file, naming the file after the package?

For example, if I have packages “One” and “Two”, the automater would export each package to two separate text files, called “One.txt” and “Two.txt”.

Is this doable?

  1. Put your query in the editor and run it

  2. Rt-click in the grid and choose “Export Blobs”

The dialog that appears will let you choose which column to export to individual files and how to name the files.