点击(此处)折叠或打开
-
DECLARE
-
-
TYPE emp_table_type IS TABLE OF emp%ROWTYPE INDEX BY BINARY_INTEGER;
-
-
v_emp_table emp_table_type;
-
-
BEGIN
-
-
SELECT * BULK COLLECT
-
INTO v_emp_table
-
FROM emp
-
--WHERE deptno = &deptno
-
;
-
forall i in v_emp_table.first..v_emp_table.last
-
update emp a
-
set a.ename = 'a - '--||i
-
where a.empno = v_emp_table(i).empno;
-
-
/*FOR i IN 1 .. v_emp_table.COUNT LOOP
-
-
dbms_output.put_line('EMPLOYEE_INFO:' || v_emp_table(i)
-
.ename ||
-
-
',' || v_emp_table(i).job ||
-
-
',' || v_emp_table(i).hiredate);
-
-
END LOOP;*/
-
-
END;
-
-------------------------------------------------------------------------
-
-
DECLARE
-
CURSOR emps_cur IS
-
SELECT last_name
-
FROM plch_employees;
-
-
TYPE t_record IS RECORD(last_name plch_employees.last_name%TYPE);
-
-
TYPE t_type_tab IS TABLE OF t_record;
-
emp_rec t_type_tab;
-
-
BEGIN
-
-
OPEN emps_cur;
-
FETCH emps_cur BULK COLLECT
-
INTO emp_rec;
-
CLOSE emps_cur;
-
-
FOR indx IN 1 .. emp_rec.COUNT LOOP
-
dbms_output.put_line(emp_rec(indx).last_name);
-
END LOOP;
-
- END