Using Query Iterator to export the a subset of data to a flat file.

I want to export a subset of data from a table that is extremely large. The table is partition by a number that represents the yyyymm that the data was entered. I created the Query Iterator(yearMonthQry) that selects the distinct yearMonth from the table. Then I want to create the export dataset from the same table by using the %yearMonthQry.yearMonth% in the where clause and also in the naming convention of the file that is generated. I looked at example for creating the Excel spreadsheet with the variables in the file name. When running this, I get the ORA-00911: invalid character message. I would appreciate any help or insight where I went wrong. I have Toad for Oracle 12.11.


Use a regular bind variable in your query in the export dataset window. Then click “Set Variables” and set it to the environment variable in specified by your query iterator.

Thanks so much for the answer. I was able to implement the solution and it worked. Based on that answer, I was then able to use the query variables to dynamically create the unique name for each file. This solution will same me time.