Oracle Userenv functions, Sys_context (NLS) __ static functions

Source: Internet
Author: User
Userenv in Oracle ()

Oracle Userenv functions, Sys_context

Get session ID with Userenv, then connect v$transaction connection v$session, check current transaction number with session ID

Select T.xid from V$transaction t join v$session s on t.addr = s.taddr where s.sid = Userenv (' Sid ')

1, USERENV (OPTION)
Returns the current session information.
Option= ' Isdba ' is true if it is currently a DBA role, or false.
option= ' LANGUAGE ' returns the character set of the database.
Option= ' SESSIONID ' is the current session identifier.
option= ' ENTRYID ' returns an auditable session identifier.
option= ' LANG ' returns the ISO denoted for the session language name.
option= ' INSTANCE ' returns the current instance.
option= ' terminal ' Returns the current computer name
SELECT USERENV (' LANGUAGE ') from DUAL;

2, Sys_context
Select
Sys_context (' USERENV ', ' TERMINAL ') TERMINAL,
Sys_context (' USERENV ', ' LANGUAGE ') LANGUAGE,
Sys_context (' USERENV ', ' SESSIONID ') SESSIONID,
Sys_context (' USERENV ', ' INSTANCE ') INSTANCE,
Sys_context (' USERENV ', ' ENTRYID ') ENTRYID,
Sys_context (' USERENV ', ' isdba ') ISDBA,
Sys_context (' USERENV ', ' nls_territory ') nls_territory,
Sys_context (' USERENV ', ' nls_currency ') nls_currency,
Sys_context (' USERENV ', ' Nls_calendar ') Nls_calendar,
Sys_context (' USERENV ', ' Nls_date_format ') Nls_date_format,
Sys_context (' USERENV ', ' nls_date_language ') nls_date_language,
Sys_context (' USERENV ', ' nls_sort ') Nls_sort,
Sys_context (' USERENV ', ' current_user ') Current_User,
Sys_context (' USERENV ', ' Current_userid ') Current_userid,
Sys_context (' USERENV ', ' session_user ') Session_user,
Sys_context (' USERENV ', ' Session_userid ') Session_userid,
Sys_context (' USERENV ', ' Proxy_user ') Proxy_user,
Sys_context (' USERENV ', ' Proxy_userid ') Proxy_userid,
Sys_context (' USERENV ', ' db_domain ') Db_domain,
Sys_context (' USERENV ', ' db_name ') db_name,
Sys_context (' USERENV ', ' host ') host,
Sys_context (' USERENV ', ' Os_user ') Os_user,
Sys_context (' USERENV ', ' external_name ') External_name,
Sys_context (' USERENV ', ' ip_address ') ip_address,
Sys_context (' USERENV ', ' Network_protocol ') Network_protocol,
Sys_context (' USERENV ', ' bg_job_id ') bg_job_id,
Sys_context (' USERENV ', ' fg_job_id ') fg_job_id,
Sys_context (' USERENV ', ' Authentication_type ') Authentication_type,
Sys_context (' USERENV ', ' authentication_data ') authentication_data
From dual

Oracle dual is a virtual table that forms the syntax rules for SELECT, and Oracle guarantees that there is always only one record in dual.

SQL language is not a universal program statement, it can interact with the outside only select update Insert Delete, all four sentences have a table, what to do without the table. Then use the dual watch.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.