场景就是系统在开发完成以后,由于序列后来全部调成10000开始,然后又对系统进行了二期开发,这样的话数据库初始化脚本就需要调整,二次开发生成的初始化数据的id都是大于10000的。所有通过以上sql可以查询出那些表和那些数据需要修改初始化脚本。
-- 查询所有表id大于10000的数据以及对应表名称 select 'select id,'''||table_name||''' as tablename from '||table_name||' where id>=10000 union ' from user_tables;
-- 显示结果如下: select id,'AUTH_MEMBER_ROLE' as tablename from AUTH_MEMBER_ROLE where id>=10000 union select id,'AUTH_ORGANIZATION' as tablename from AUTH_ORGANIZATION where id>=10000 union select id,'AUTH_PERMISSION' as tablename from AUTH_PERMISSION where id>=10000 union select id,'AUTH_PRODUCT' as tablename from AUTH_PRODUCT where id>=10000 union select id,'AUTH_PRODUCT_ABOUT'as tablename from AUTH_PRODUCT_ABOUT where id>=10000 union select id,'AUTH_ROLE' as tablename from AUTH_ROLE where id>=10000 union select id,'AUTH_USER' as tablename from AUTH_USER where id>=10000 union ......... -- 然后执行获得的结果,获得所需要的结果内容。