The "Generate Schema Script" (Database | Export | Generate Schema Script) is used to generate a script of all packages in a schema. The "Sort for Creation" under Script Option tab is checked, in order to have a sorted script. The following error message occurs when Create Script button is select:
"This schema contains either circular references or references to invalid objects which prevents TOAD from sorting the last xx items. TOAD has attempted to sort them anyway, and a list of these objects can be found at the end of the script".
Packages call other packages that are circularly referenced.
1. Under the first tab "Source and Output" of the Generate Schema Script, check the "File will be used for HTML schema doc generation" check-box. A file name does not have be supplied.
2. Go to the "Script Options" tab and un-check the "Sort for Creation" check-box. This will cause the packages to be sorted alphabetically.
The "Def file will be used for HTML schema doc generation" checkbox causes alphabetical sorting by package name. The "Sort for Creation" checkbox causes dependency sorting. If neither options are checked, script will be ordered by dba_objects view.