GBase数据库查找失效视图,以及失效视图所对应的基表
记录!
1、首先要找到失效的视图,善于使用系统数据库
使用sql语句
select * from information_schema.VIEWS where information_schema.VIEWS.is_updatable like 'NO'
2、拿到VIEW_DEFINITION字段,使用
net.sf.jsqlparser.statement.Statement statement = CCJSqlParserUtil.parse(view_details_sql);
Select selectStatement = (Select) statement;
TablesNamesFinder tablesNamesFinder = new TablesNamesFinder();
List tableList = tablesNamesFinder.getTableList(selectStatement);
拿到使用的表
然后使用try catch 拿到报错的被删除的基表