GENERATE_SQL_OBJECTS is a SQL procedure I have used which I have found very useful, but have not written about. It allows me to recreate the SQL statement that was used to create a SQL object or objects into a source file member. I could change many of SQL objects using the ALTER statement. But, in my opinion, it is easier to change the statement in a source member. I make sure that the create statement is CREATE OR REPLACE, create the changed object and old one is replaced.
There are two things I consider minor inconveniences to using this SQL procedure:
- I cannot pass the name of the object to the procedure. All of the objects I wish to retrieve the create statement for must be placed in a DDL Table, that procedure then "reads".
- The source member that is generated contains the create statements for all of the objects listed in the above Table.
I can use this with most SQL object types. In this example I am only using it with a few I have mentioned in previous posts.