Creating an OBJECT Type in an Oracle Database - Java JDBC

Java examples for JDBC:Oracle

Description

Creating an OBJECT Type in an Oracle Database

try {
    Statement stmt = connection.createStatement();

    // Create the object2 type
    stmt.execute("CREATE TYPE object2 AS OBJECT" + "(col_string2 VARCHAR(30), col_integer2 NUMBER)");

    // Create the object1 type
    stmt.execute("CREATE TYPE object1 AS OBJECT" + "(col_string1 VARCHAR(30), col_integer2 object2)");

    // Create a table with a column to hold a number and the new object1 type
    stmt.execute("CREATE TABLE object1_table(col_integer NUMBER, col_object1 object1)");
} catch (SQLException e) {
}

Related Tutorials