안녕하세요. 해당 프로시저를 DBMS_SCHEDULER에 태워서 사용하려고 하고 있습니다.
하기 프로시저 문법이 잘못되었는데 해결 방법이 도무지 생각 나질 않네요.
PLS-00103에러가 18,19라인에서 발생합니다..
CREATE or REPLACE procedure KILL_SESSION
IS
V_SQL VARCHAR2(1000);
V_SID VARCHAR(50);
V_SERIAL# VARCHAR(50);
V_INST_ID VARCHAR2(50);
BEGIN
FOR X IN(
SELECT A.INST_ID, A.USERNAME, A.PREV_EXEC_START, A.PROGRAM, A.MACHINE, A.SQL_ID, A.TERMINAL
FROM GV$SESSION A, GV$PROCESS B
WHERE 1=1
AND A.INST_ID = B.INST_ID
AND A.PADDR = B.ADDR
AND A.USERNAME IN ('A1','B1')
AND A.PROGRAM IN ('C1')
AND A.USERNAME IS NOT NULL
)
V_SID := X.SID;
V_SERIAL# := X.SERIAL#;
V_INST_ID := X.INST_ID;
LOOP
V_SQL := 'ALTER SYSTEM KILL SESSION '''|| X.SID || ',' || X.SERIAL# || ', @' ||X.INST_ID||''
EXECUTE IMMEDIATE V_SQL;
END LOOP;
END KILL_SESSION;
CREATE or REPLACE procedure KILL_SESSION
IS
V_SQL VARCHAR2(1000);
V_SID VARCHAR(50);
V_SERIAL# VARCHAR(50);
V_INST_ID VARCHAR2(50);
BEGIN
FOR X IN(
SELECT A.INST_ID, A.USERNAME, A.PREV_EXEC_START, A.PROGRAM, A.MACHINE, A.SQL_ID, A.TERMINAL, A.SID, A.SERIAL#
FROM GV$SESSION A, GV$PROCESS B
WHERE 1=1
AND A.INST_ID = B.INST_ID
AND A.PADDR = B.ADDR
AND A.USERNAME IN ('A1','B1')
AND A.PROGRAM IN ('C1')
AND A.USERNAME IS NOT NULL
) LOOP
V_SID := X.SID;
V_SERIAL# := X.SERIAL#;
V_INST_ID := X.INST_ID;
V_SQL := 'ALTER SYSTEM KILL SESSION '''|| X.SID || ',' || X.SERIAL# || ', @' ||X.INST_ID||'';
EXECUTE IMMEDIATE V_SQL;
END LOOP;
END KILL_SESSION;
/
일단 이렇게 하면 컴파일은 되네요