public boolean existsView ( final Connection _con , final String _viewName ) throws SQLException { boolean ret = false ; final DatabaseMetaData metaData = _con . getMetaData ( ) ; // first test with lower case final ResultSet rs = metaData . getTables ( null , null , _viewName . toLowerCase ( ) , new String [ ] { "VIEW" } ) ; if ( rs . next ( ) ) { ret = true ; } rs . close ( ) ; // then test with upper case if ( ! ret ) { final ResultSet rsUC = metaData . getTables ( null , null , _viewName . toUpperCase ( ) , new String [ ] { "VIEW" } ) ; if ( rsUC . next ( ) ) { ret = true ; } rsUC . close ( ) ; } return ret ; }
The method tests if a view with given name exists .