Did you check SYS_CONTEXT() function?