I want to drop specified oracle tables, views, procedures and functions via Java JDBC Code.
For example, Suppose I've tables T1, T2, T3. Views V1, V2, V3. Procedure P1, P2, P3 and functions F1, F2, F3.
How can I delete these Tables, Views, Procedures and Functions using JDBC?
I've already tried
statement.execute("drop table T1");
statement.executeUpdate("drop table T1");
statement.executeQuery("drop table T1");
Not working !!!
There's nothing special about JDBC in this context. Just run the relevant DDLs with it:
Connection conn = /* connect to the database*/
try (Statement s = conn.createStatement()) {
s.execute("DROP FUNCTION f1");
s.execute("DROP FUNCTION f2");
s.execute("DROP FUNCTION f3");
s.execute("DROP PROCEDURE p1");
s.execute("DROP PROCEDURE p2");
s.execute("DROP PROCEDURE p3");
s.execute("DROP VIEW v1");
s.execute("DROP VIEW v2");
s.execute("DROP VIEW v3");
s.execute("DROP TABLE t1");
s.execute("DROP TABLE t2");
s.execute("DROP TABLE t3");
}