테스트 준비 - 프로시져 생성 및 상태 확인
create or replace procedure p1
is
begin
for i in (select cust_id from customer)
loop
dbms_output.put_line(i.cust_id);
end loop;
end;
/
create or replace procedure p2
is
begin
for i in (select * from customer)
loop
dbms_output.put_line(i.cust_id);
end loop;
end;
-- 새로 생성한 프로시져 2개의 상태는 정상
select object_name, object_type, created, status
from user_objects
where lower(object_name) in ('p1','p2');
/*
OBJECT_NAME OBJECT_TYPE CREATED STATUS
------------------------------ ----------------------- --------- -------
P1 PROCEDURE 10-MAY-24 VALID
P2 PROCEDURE 17-MAY-24 VALID
*/
- 컬럼 추가 및 변경 테스트
--ading column to proce May or May not invalidate according for the logic of changes
alter table customer add( addresss varchar2(100));
select object_name, object_type, created, status
from user_objects
where lower(object_name) in ('p1','p2');
/*
OBJECT_NAME OBJECT_TYPE CREATED STATUS
------------------------------ ----------------------- --------- -------
P1 PROCEDURE 10-MAY-24 VALID
P2 PROCEDURE 17-MAY-24 INVALID
*/
exec p2;
-- P2의 상태를 정상으로 변경됨
--altering column to proce May or May not invalidate according for the logic of changes
alter table customer modify cust_id number(10);
-- 2개의 프로시져에 관련된 컬럼에 대한 변경으로 상태가 모두 비정상으로 변경됨
select object_name, object_type, created, status
from user_objects
where lower(object_name) in ('p1','p2');
/*
OBJECT_NAME OBJECT_TYPE CREATED STATUS
------------------------------ ----------------------- --------- -------
P1 PROCEDURE 10-MAY-24 INVALID
P2 PROCEDURE 17-MAY-24 INVALID
*/
'Database > PLSQL' 카테고리의 다른 글
114 - [Oracle PL/SQL] Dependencies - Impact on the Package (0) | 2024.05.21 |
---|---|
113 - [Oracle PL/SQL] Dependencies - Impact on the Package (0) | 2024.05.21 |
111 - [Oracle PL/SQL] Dependencies - Impact on the Function (0) | 2024.05.20 |
110 - [Oracle PL/SQL] Dependencies - Impact on the View (0) | 2024.05.17 |
109 - [Oracle PL/SQL] Dependencies - 객체의 4가지 상태 (0) | 2024.05.17 |