db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yves pielusenet <yvespieluse...@free.fr>
Subject Re: DROP IF NOT EXISTS
Date Thu, 14 Sep 2006 22:04:45 GMT
Thank you :)
Le vendredi 15 septembre 2006 à 01:55 +0200, Bernt M. Johnsen a écrit :
> yves pielusenet wrote:
> > I wonder if there is something similare like :
> > 'drop index id_index if not exists' ?
> > I want to put a condition on a drop statement but it fails.
> > how can I do ?
> > 
> 
> You could do it like this:
> 
> try {
>    stmt.executeUpdate("drop index id_index");
> } catch (SQLException e) {
>     if (!e.getSQLState().equals("xxxxx") {
>         throw e;
>     }
> }
> 
> 
> where xxxxx is the SQL State you get when trying to delete a
> non-existing index.
> 
> > thanks ,
> > 
> 
> 


Mime
View raw message