我已经做了程序
create or replace PROCEDURE KILLSESSION AS
BEGIN
for rec in (SELECT sid,serial#
FROM v$session
WHERE status = 'ACTIVE'
AND username ='NCMAIN'
AND sql_id ='bzq9gwv2qazpq' ) loop
execute immediate 'Alter System Kill Session '''|| rec.Sid || ',' || rec.Serial# || ''' IMMEDIATE';
end loop;
END KILLSESSION
我收到表或视图不存在且使用循环变量rec 无效的错误。我在 DBA 模式中创建了过程。