Oracle array type the array type of Oracle. Example: SQL code create or replace function my_test (p_str varchar2) return number as -- Common variable v_var varchar2 (1000 ); -- fixed length array type v_ar is varray (10) of varchar2 (30); my_ar v_ar: = v_ar ('G', 'M', 'D', 'hangzhou ', 'shuai '); -- Variable Length Value type type_array is table of varchar2 (20) index by binary_integer; var_array type_array; -- similar to the two-dimensional array type serv_array is table of itmis_pri_serv_tbl % rowtype index by binary_integer; var_serv serv_array; www.2cto.com -- Record block, stores a record variable, struct TYPE t_myRecord is record (Field1 number, Field2 varchar2 (50); var_record t_myRecord; begin v_var: = 'Hello world'; dbms_output.put_line (v_var ); for I in 1 .. my_ar.count loop dbms_output.put_line (my_ar (I); end loop; ------------------------------------------ var_array (1): = 'a'; var_array (2): = 'bb '; -- subscript must be continuous for I in 1 .. var_array.count loop dbms_output.put_line (var_array (I); end loop; tables can be used as a temporary table variable -- select * bulk collect into var_serv from itmis_pri_serv_tbl where year = 2013; -- similar to the two-dimensional array select * bulk collect into var_serv from itmis_pri_serv_tbl; -- two-dimensional array access for I in 1 .. var_serv.count loop dbms_output.put_line (var_serv (I ). serv_id); dbms_output.put_line (var_serv (I ). status); end loop;
-- Record fast access WITH temp (id, name) as (select 1, 'Sam 'from dual union all select 2, 'Tom' from dual union all select 3, 'Kelly 'from dual) Select id, name Into var_record From temp where id = 1; dbms_output.put_line ('var _ record:' | var_record.Field1 | ''| var_record.Field2 ); return length (p_str); end; www.2cto.com/* 1. COUNT returns the number of elements in the set. 2. DELETE: DELETE all elements in the set. 3. DELETE (x) Deleting an element whose subscript is x is invalid for VARRAY. 4. DELETE (x, y) The element marked from X to Y is invalid for VARRAY. EXIST (x) if the set element x has been initialized, TRUE is returned; otherwise, FALSE 6 is returned. EXTEND adds an element at the end of the set that is invalid for Index_by. 7. EXTEND (x) adds x elements at the end of the Set, which is invalid for Index_by. EXTEND (x, n) adding x copies of element n at the end of the set is invalid for Index_by 9. FIRST returns the bottom label of the FIRST element in the Set, and 1 is always returned for the VARRAY set. 10. the bottom number of the LAST element in the LAST returned set. The return value for VARRAY is always equal to COUNT. 11. LIMIT returns the maximum number of elements in the VARRY set. The Index_by set and the nested table are useless. 12. NEXT (x) returns the element value after the x element and NEXT to it. If x is the last element, null is returned. 13. PRIOR (x) returns the value of the element next to it before the x element. If x is the first element, null is returned. 14. TRIM deletes an element from the end of the set. It is invalid for index_by. 15. TRIM (x) deletes x elements from the end of the Set var_array.next (3); // returns var_array (3 )*/