这个压缩包里的都是超级经典的java例子
源代码在线查看: getarray.htm
Getting a VARRAY Value from an Oracle Table (Java Developers Almanac Example)
The Java Developers Almanac 1.4
Order this book from Amazon.
google_ad_client = "pub-6001183370374757";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_channel = "4777242811";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "6666CC";
google_color_url = "6666CC";
google_color_text = "000000";
//-->
Home
>
List of Packages
>
java.sql
[73 examples]
>
Oracle VARRAYs
[4 examples]
e304. Getting a VARRAY Value from an Oracle Table
This example retrieves values contained in an Oracle VARRAY type. The
example uses the table and array type created in
e301 Creating a VARRAY Type in an Oracle Database.
try {
// Create a statement
Statement stmt = connection.createStatement();
// Select rows from varray_table
ResultSet resultSet = stmt.executeQuery("SELECT * FROM varray_table");
// Get the VARRAY values from each row
while (resultSet.next()) {
// Get the VARRAY value in the first column
oracle.sql.ARRAY array = ((oracle.jdbc.driver.OracleResultSet)resultSet).getARRAY(1);
// Get the VARRAY elements; values.length is the number of values in the VARRAY
java.math.BigDecimal[] values = (java.math.BigDecimal[])array.getArray();
}
} catch (SQLException e) {
}
Related Examples
e301.
Creating a VARRAY Type in an Oracle Database
e302.
Inserting a VARRAY Value into an Oracle Table
e303.
Inserting a VARRAY Value into an Oracle Table Using a Prepared Statement
See also:
Batching
Connections
Database Meta Data
Deleting Data
Drivers
Importing and Exporting
Inserting and Updating Data
Oracle OBJECTs
Procedures and Functions
Retrieving Data
Scrollable Result Sets
Tables
Updatable Result Sets
© 2002 Addison-Wesley.