3 Replies Latest reply on Jul 2, 2010 6:41 AM by Billy~Verreynne

    how to do "DDL rollback"

      I have script, that contains several DDL-statements. For example script removes FK-constraint from a column, then it renames the column, then it puts new data to the column, then it puts new FK-constraint to the column, also some other ALTER-statements are done, and with several tables.
      I want to test my such script. I want to test so that if something in my long script throws error, then i can rollback all made ddl changes and fox the script and rerun the script again. How can i do this?
      It could be something like this:
      begin DDL tran;
         alter 1
         alter 2
         alter N
      when others then
         rollback all ddl
      end DDL tran;