Sie sind auf Seite 1von 3

What is a collection? A collection is a group of values where all values are of the same type.

Oracle provides three types of collections Indexed Tables, Nested Tables, and VARRAYs. What is a VARRAY? VARRAY stands for variable-size array. It is an array that can be either manipulated as a whole or individually as elements. It has a maximum size and can contain 0 to any number of elements up to the maximum specified. You can use VARRAY data type for: A column in a relational table A PL/SQL variable A PL/SQL parameter of procedure or function A PL/SQL function return type A data attribute of an object type CREATE TYPE array_name AS VARRAY (limit) Array_name Limit Data_type object type. OF data_type

is the name of the VARRAY data type. is the maximum number of elements that the array can have is the type of each element of the array. It can be any standard type or

create type project_type as object ( name varchar2(50), role varchar2(20) ) create type projectlist as VARRAY(5) of project_Type; create table emp ( empno number(5), ename varchar2(30), projects projectlist ); Nested Table Nested table is a table that is stored in database as the data of a column of the table. Nested table is like an IndexBy table, but the main difference is that a nested table can be stored in the database and an Index-by table cannot. Collection methods are used to provide information and manage collections in PL/SQL. They cannot be used in SQL but a collection can be changed by these methods and the result can be put back to table.
EXISTS(n) - Returns TRUE if the specified element exists. COUNT - Returns the number of elements in the collection. LIMIT - Returns the maximum number of elements for a VARRAY, or NULL for nested tables. FIRST - Returns the index of the first element in the collection. LAST - Returns the index of the last element in the collection. PRIOR(n) - Returns the index of the element prior to the specified element. NEXT(n) - Returns the index of the next element after the specified element.

These tables do not reside in the system catalogs and are not persistent. Temporary tables exist only during the connection that declared them and cannot be referenced outside of that connection. When the connection closes, the rows of the table are deleted, and the in-memory description of the temporary table is dropped. Temporary tables are useful when: The table structure is not known before using an application. Other users do not need the same table structure. Data in the temporary table is needed while using the application. The table can be declared and dropped without holding the locks on the system catalog. Syntax DECLARE GLOBAL TEMPORARY TABLE table-Name { column-definition [ , column-definition ] * } [ ON COMMIT {DELETE | PRESERVE} ROWS ] NOT LOGGED [ON ROLLBACK DELETE ROWS] ON COMMIT Specifies the action taken on the global temporary table when a COMMIT operation is performed. DELETE ROWS ON COMMIT DELETE ROWS will delete the rows in the table even if the table was not used (if the table does not have hold-able cursors open on it). PRESERVE ROWS The rows of the table will be preserved.

Ship Confirm: wsh_delivery_details_pub.autocreate_deliveries WSH_DELIVERIES_PUB.Delivery_Action wsh_ship_confirm_actions.interface_all Lines/Headers Close: oe_order_pub.process_order

cst_item_costs csc , mtl_item_categories micat , mtl_categories mcat , mtl_system_items_b msi , mtl_categories_b mcb

AND msi.organization_id = micat.organization_id(+) AND msi.inventory_item_id = micat.inventory_item_id(+) AND micat.category_id = mcat.category_id(+) AND csc.inventory_item_id(+) = msi.inventory_item_id AND mcb.category_id = mcat.category_id AND mcb.category_id = micat.category_id

Das könnte Ihnen auch gefallen