Re: How to kill a session (Script)

From: David A. Levy <david.a.levy_at_rogers.com>
Date: Mon, 28 Jan 2002 21:07:02 GMT
Message-ID: <W3j58.4242$liz.3068_at_news2.bloor.is>


Hi Geoffrey,

I think the problem you are having is that only DML and SELECT SQL statements are allowed to be used directly in PL/SQL. So you can do INSERT, SELECT etc, but not ALTER, CREATE etc. You have to use dynamic SQL. So this procedure does NOT work:

CREATE OR REPLACE PROCEDURE
PROCEDURE sample_alter AS
BEGIN
alter system enable restricted session;
END; whereas this one should (assuming the user owning the procedure has privs to execute an ALTER SYSTEM in the first place)

PROCEDURE SCOTT.sample_alter IS
BEGIN
execute immediate 'alter system enable restricted session'; END; If the user does not have the privs you will get messages like these:

ERROR at line 1:

ORA-01031: insufficient privileges
ORA-06512: at "SCOTT.SAMPLE_ALTER", line 3
ORA-06512: at line 1

hope this helps,
David. Received on Mon Jan 28 2002 - 22:07:02 CET

Original text of this message