>>>>>>>>>>>> [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"))
                throw e;
        }

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

Attachment: pgpN1lu1d44lT.pgp
Description: PGP signature

Reply via email to