⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e303. inserting a varray value into an oracle table using a prepared statement.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
This example inserts a row with a VARRAY of numbers as defined in e301 Creating a VARRAY Type in an Oracle Database. This example uses a prepared statement. 
    try {
        // Create an oracle.sql.ARRAY object to hold the values
        oracle.sql.ArrayDescriptor arrayDesc =
            oracle.sql.ArrayDescriptor.createDescriptor("number_varray", connection);
        int arrayValues[] = {123, 234};
        oracle.sql.ARRAY array = new oracle.sql.ARRAY(arrayDesc, connection, arrayValues);
    
        // Create a prepared statement for insertion into varray_table
        PreparedStatement ps =
            connection.prepareStatement("INSERT INTO varray_table VALUES(?)");
    
        // Set the values to insert
        ((oracle.jdbc.driver.OraclePreparedStatement)ps).setARRAY(1, array);
    
        // Insert the new row
        ps.execute();
    } catch (SQLException e) {
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -