※ 변수 = 값, rowtype=1차원값들, table=2차원 값들 <= cursor도 2차원 값
Cursor Ex)
S SCOTT> declare
2 cursor emp_cur is select * from emp where deptno=10;
3
4 begin
5 for emrow in emp_cur loop
6 dbms_output.put_line(emrow.ename);
7 end loop;
8 end;
9 /
CLARK
KING
MILLER
PL/SQL procedure successfully completed.
▣ scott.emp.ename 으로 유저를 생성하시오. 접속 가능할 것, scott 유저는 이미 있으므로 만들지 말 것
declare
cursor empuser_cur is select scott.emp.ename from scott.emp where emp.ename not like 'SCOTT';
begin
for cuser in empuser_cur loop
execute immediate 'create user || cuser.ename || ' identified by a';
execute immediate 'grant create session to '|| cuser.ename;
end loop;
end;
/
댓글 없음:
댓글 쓰기