1 package body FND_AUDIT_SEQ_PKG as
2 /* $Header: AFATUTLB.pls 120.1 2005/07/02 03:57:28 appldev ship $ */
3
4 --
5 -- Global variables
6 -- FND_AUDIT_GLOBAL number; (current sequence number)
7 -- FND_AUDIT_COMMIT number; (current commit number)
8 --
9
10 --
11 -- Function NXT - returns next sequence number for a new audit row.
12 --
13 Function NXT
14 return Number is
15 Begin
16 FND_AUDIT_GLOBAL:= FND_AUDIT_GLOBAL+1;
17 return FND_AUDIT_GLOBAL;
18 End;
19
20 --
21 -- Function CMT - returns the current commit number; i.e. the number of
22 -- commits done in the current session.
23 -- a lock is requested and if a commit occurs, the lock is released and
24 -- the commit number (FND_AUDIT_COMMIT) is incremented.
25 --
26 Function CMT
27 return Number is
28 LOCKNUM number;
29 Begin
30 LOCKNUM := dbms_lock.request(2000000001, dbms_lock.nl_mode,0,TRUE);
31 if (LOCKNUM = 0) then
32 FND_AUDIT_COMMIT := FND_AUDIT_COMMIT+1;
33 end if;
34 return FND_AUDIT_COMMIT;
35 End;
36
37 --
38 -- Function USER_NAME
39 -- returns the current Applications user name if an applications context
40 -- exists and the current database account otherwise.
41 --
42 Function USER_NAME
43 return varchar2 is
44 NUSER varchar2(100);
45 Begin
46 NUSER := FND_GLOBAL.USER_NAME;
47 if (NUSER is NULL) then
48 select USER into NUSER from dual;
49 end if;
50 return NUSER;
51 End;
52 End FND_AUDIT_SEQ_PKG;