|
-
This error is telling you that your SQL statment is not correct. I am guessing it is because of the ";" at the end of your statement. Also, I would ltrim(rtrim()) your to_char results because sometimes oracle puts a blank space in front of the value for a - sign holder.
Try:
create or replace procedure kill_locked_usr_tds2
(time in integer) as
my_cursor integer;
my_statement varchar2(80);
result integer;
cursor c1 is
select 'alter system kill session '''
||ltrim(rtrim(to_char(a.sid)))||','||ltrim(rtrim(to_char(a.serial#)))||''''
from v$session a, v$lock b
where a.sid = b.sid
and b.lmode = 6
and a.username= 'TDS_LOADER'
and b.ctime > time;
begin
open c1;
loop
fetch c1 into my_statement;
exit when c1%notfound;
my_cursor := dbms_sql.open_cursor;
dbms_sql.parse(my_cursor,my_statement,dbms_sql.v7);
result :=dbms_sql.execute(my_cursor);
dbms_sql.close_cursor(my_cursor);
end loop;
close c1;
end;
/
Jeff Hunter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|