Guenadi N Jilevski's Oracle BLOG

Listing active contexts in Oracle

— Listing active contexts
CREATE OR REPLACE PROCEDURE listContext AS
list DBMS_SESSION.APPCTXTABTYP;
cnt NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_territory = ‘||SYS_CONTEXT(‘userenv’,’nls_territory’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_currency = ‘||SYS_CONTEXT(‘userenv’,’nls_currency’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_calendar = ‘||SYS_CONTEXT(‘userenv’,’nls_calendar’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_date_format = ‘||SYS_CONTEXT(‘userenv’,’nls_date_format’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_date_language = ‘||SYS_CONTEXT(‘userenv’,’nls_date_language’));
DBMS_OUTPUT.PUT_LINE(‘USERENV nls_sort = ‘||SYS_CONTEXT(‘userenv’,’nls_sort’));
DBMS_OUTPUT.PUT_LINE(‘USERENV session_user = ‘||SYS_CONTEXT(‘userenv’,’session_user’));
DBMS_OUTPUT.PUT_LINE(‘USERENV current_user = ‘||SYS_CONTEXT(‘userenv’,’current_user’));
DBMS_OUTPUT.PUT_LINE(‘USERENV current_schema = ‘||SYS_CONTEXT(‘userenv’,’current_schema’));
DBMS_OUTPUT.PUT_LINE(‘USERENV current_schemaid = ‘||SYS_CONTEXT(‘userenv’,’current_schemaid’));
DBMS_OUTPUT.PUT_LINE(‘USERENV session_userid = ‘||SYS_CONTEXT(‘userenv’,’session_userid’));
DBMS_OUTPUT.PUT_LINE(‘USERENV currend_userid = ‘||SYS_CONTEXT(‘userenv’,’current_userid’));
— Listing user defined namespaces
DBMS_SESSION.LIST_CONTEXT(list, cnt);
FOR i IN 1..cnt LOOP
DBMS_OUTPUT.PUT_LINE(list(i).namespace||’  ‘||list(i).attribute||’ = ‘||list(i).value);
END LOOP;
END;
/

View original post

Advertisements

Posted on October 8, 2012, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: