>>>>>>>>>>>> Bernt M. Johnsen wrote (2005-09-26 12:09:26):
> >>>>>>>>>>>> [EMAIL PROTECTED] wrote (2005-09-26 18:11:26):
> > Hi there,
> > 
> > To initialize my database, I want to use an SQL 
> > equivalent of "DROP TABLE IF EXISTS MY_TABLE" .
> > 
> > I've tried it but of course didn't work
> > 
> > Does Derby support this kinda SQL or Is there any workaround
> > I can drop a table if it exists ??
> 
> One way could be:
>         try {
>             stmt.executeUpdate("DROP TABLE MY_TABLE");
>         } catch (SQL_Exception e) {
>             if (!e.getSQLState().equals("proper SQL-state for table does not 
> exist"))

In Derby it is:
             if (!e.getSQLState().equals("42Y55"))

-- 
Bernt Marius Johnsen, Database Technology Group, 
Sun Microsystems, Trondheim, Norway

Attachment: pgpwXnxfQnQVB.pgp
Description: PGP signature

Reply via email to