APEX User details
NVL(v('APP_USER'), user) alternative
Fresh from the factory - AUSOUG Connect2016
One of the things that I will take home from AUSOUG Connect2016 in Perth is nice little tip from Scott and his team.
NVL(v('APP_USER'), user)
For the future you might be using:
coalesce ( sys_context('APEX$SESSION', 'app_user')
, regexp_substr(sys_context('userenv', 'client_identifier') ,'^[^:]*') --for remote users
, sys_context('userenv', 'session_user')
Reason being it works faster then NVL combination especially on large scale data.
When working in Oracle 12c this can even became part of you table script:
So there will be no need to do this in your trigger body anymore....., created_by varchar2(40) defaultcoalesce ( sys_context('APEX$SESSION', 'app_user'), regexp_substr(sys_context('userenv', 'client_identifier') ,'^[^:]*')
, sys_context('userenv', 'session_user')not null......
Thanks again for sharing.
Cheers,
Lino
Tks!
ReplyDelete