简体   繁体   中英

Sytem table name for schema

SELECT SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA') 
   FROM DUAL;

Gives the current Schema, I am trying to build function DB2 equivalent to Oracle SYS_CONTEXT . I am not getting how oracle is selecting schema name. Any system table where it stores all schema name is some one have any insight please help

Any system table where it stores all schema name

You could use the *_USERS view to get the schema names. In Oracle , schema name and username are synonymous.

For example, to get all the schema names:

SELECT username FROM all_users;

To see the current user:

SELECT username FROM user_users;

If you are using SQL*Plus , you could simply do:

SHOW USER

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM