Element_type : The data type of the collection element is any PL/SQL data type except REF CURSOR. Check the below example where we are using collecting element type as cursor.
element_type:
Check The Below Example:
IS TABLE OF all_emp_dat_cur%ROWTYPE INDEX BY PLS_INTEGER;
v_all_emp_dat_tbl all_emp_dat_tbl ;
element_type:
{ cursor_name%ROWTYPE
| db_table_name{%ROWTYPE | .column_name%TYPE}
| object_name%TYPE
| [REF] object_type_name
| scalar_datatype_name
| record_name[.field_name]%TYPE
| record_type_name
| variable_name%TYPE
}
| db_table_name{%ROWTYPE | .column_name%TYPE}
| object_name%TYPE
| [REF] object_type_name
| scalar_datatype_name
| record_name[.field_name]%TYPE
| record_type_name
| variable_name%TYPE
}
Check The Below Example:
DECLARE
/*Declare Cursor*/
CURSOR all_emp_dat_cur
IS
SELECT * FROM EMP;
/*Declare table type, element as CURSOR*/
TYPE all_emp_dat_tbl IS TABLE OF all_emp_dat_cur%ROWTYPE INDEX BY PLS_INTEGER;
v_all_emp_dat_tbl all_emp_dat_tbl ;
BEGIN
OPEN all_emp_dat_tbl;
FETCH all_emp_dat_tbl BULK COLLECT INTO v_all_emp_dat_tbl;
CLOSE all_emp_dat_tbl;
/*write your logic */
END;
No comments:
Post a Comment