When logging messages, it makes sense to capture the session SID and SERIAL#. We can easily capture SID using sys_context('userenv', 'SID') and set this as a package constant, but there is no userenv entry for SERIAL#.
The recommended approach is to query v$session, but that is not accessible from stored PL/SQL by default and so requires an additional grant by SYS (not trivial to justify in a security-audited environment such as a bank), and even with that in place we cannot define it as a package constant or column default but need to write additional code to populate a variable (or write a function etc).
An alternative is to abandon SERIAL# and instead use AUDSID which can be populated with sys_context('userenv','sessionid'); however this is not the recommended use of AUDSID for various reasons (issues around background and distributed sessions), and in any case does not link to Oracle monitoring views such as v$active_session_history which use the standard sid, serial# combination to identify sessions.
Please can we have the value of the current session's SERIAL# made available through the default SYS_CONTEXT USERENV
namespace as is already the case with SID.