PXT_SESSION_CLEANUP
Arguments:
| Name | Data Type | Default Value | In/Out |
|---|
| BOUND_IN | NUMBER(38) | | IN |
| COMMIT_INTERVAL | NUMBER(38) | | IN |
| BATCH_SIZE | NUMBER(38) | | IN |
| SESSIONS_DELETED | NUMBER(38) | | IN/OUT |
DDL scriptSource
Legend: string keyword reserved word operator
1: procedure pxt_session_cleanup
2: (bound_in in number, commit_interval in number := 100,
3: batch_size in number := 50000, sessions_deleted in out number)
4: is
5: PRAGMA AUTONOMOUS_TRANSACTION;
6:
7: cursor sessions (bound_val in number) is
8: select rowid from PXTSessions
9: where expires < bound_val;
10:
11: counter number := 0;
12:
13: begin
14:
15: for session in sessions (bound_in) loop
16:
17: delete from PXTSessions where rowid = session.rowid;
18:
19: counter := counter + 1;
20: if mod(counter, commit_interval) = 0 then
21: commit;
22: end if;
23:
24: if counter >= batch_size then
25: commit;
26: sessions_deleted := counter;
27: return;
28: end if;
29:
30: end loop;
31:
32: commit;
33:
34: sessions_deleted := counter;
35:
36: end;