Generate upgrade script to ALTER TABLE based on CREATE TABLE statement in Oracle [duplicate]

落爺英雄遲暮 提交于 2019-12-11 04:40:53

问题


Is it possible in Oracle to generate a bunch of ALTER TABLE statements based on existing table in schema plus CREATE TABLE statement with newer definition of that table?

Let's say I have a schema with some previous version of an application. I have an installation script for newest version of the application. The script creates all tables and sequences from scratch performing CREATE TABLE (and probably CREATE SEQUENCE) statements.

I'd like to update the schema to the newest version of the application without loosing any data (e.g. without performing DROP TABLE).

Is it possible with using of standard Oracle 11gR2 or third party components?


回答1:


You can try CORT : www.softcraftltd.co.uk/cort It's free




回答2:


You can create a procedure in PLSQL to:

  • create new table when it not exists in new DB
  • alter table when it exists, feeding it with ALL_TAB_COLUMNS


来源:https://stackoverflow.com/questions/28678190/generate-upgrade-script-to-alter-table-based-on-create-table-statement-in-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!