Toad World® Forums

Export source code

In a previous version of Toad I had a scheduled job running which each night exported the scripts of my views, triggers, functions etc. from a selected schema.

When a new function was added, it was automatically added to the script because ALL functions were exported.

Now it seems for me, that I have to select each item that I want to export, so when I have e new function, I have to add that to my scheduled job.

How do I set up a script using Toad (version 12.6) to generate a SQL-file for each object in a schema automatically each night?

If you have the DBA Module or Expert Edition, you can do this from Generate Schema Script.

If not, you can set up this query and use “Export Dataset” to send the results to a delimited text file (CLOBS are automatically excluded - be sure to uncheck that)

select trim(dbms_metadata.GET_DDL(decode(object_type,

‘PACKAGE BODY’, ‘PACKAGE_BODY’,

‘PACKAGE’, ‘PACKAGE_SPEC’, object_type), object_name)) || chr(10) || ‘/’

from dba_objects

where owner = ‘JDORLON’ – change to whatever schema you like…

and object_type in (‘PROCEDURE’, ‘FUNCTION’, ‘PACKAGE’, ‘PACKAGE BODY’)

order by object_type

Both of these can be set up as a job from the automation designer in Toad.

@John,

people from Toad sales would not like your answer too much.

:slight_smile:

Damir