Categories
ApEx Oracle PL/SQL

Getting Session Environment Parameters in Oracle


Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

Warning: Undefined array key "ssba_bar_buttons" in /home/techdribble/public_html/wp-content/plugins/simple-share-buttons-adder/php/class-buttons.php on line 598

To display all environment variable values for a given oracle session, run the following code:

begin
FOR i IN 1..owa.num_cgi_vars LOOP
htp.p(owa.cgi_var_name(i)||' : '||owa.cgi_var_val(i));
END LOOP;
end;

The name of the environment variable and value will be displayed. To reference each variable individually use the following syntax:

OWA_UTIL.get_cgi_env(VARIABLE_NAME)

eg. OWA_UTIL.get_cgi_env(‘REQUEST_PROTOCOL’)

Here’s the list of all available variables:

PLSQL_GATEWAY
GATEWAY_IVERSION
SERVER_SOFTWARE
GATEWAY_INTERFACE
SERVER_PORT
SERVER_NAME
REQUEST_METHOD
PATH_INFO
SCRIPT_NAME
REMOTE_ADDR
SERVER_PROTOCOL
REQUEST_PROTOCOL
REMOTE_USER
HTTP_CONTENT_LENGTH
HTTP_CONTENT_TYPE
HTTP_USER_AGENT
HTTP_HOST
HTTP_ACCEPT
HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE
HTTP_REFERER
HTTP_ORACLE_ECID
WEB_AUTHENT_PREFIX
DAD_NAME
DOC_ACCESS_PATH
DOCUMENT_TABLE
PATH_ALIAS
REQUEST_CHARSET
REQUEST_IANA_CHARSET
SCRIPT_PREFIX
HTTP_COOKIE

Sample Output:

PLSQL_GATEWAY : WebDb
GATEWAY_IVERSION : 3
SERVER_SOFTWARE : Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server
GATEWAY_INTERFACE : CGI/1.1
SERVER_PORT : 7780
SERVER_NAME : dummyserver
REQUEST_METHOD : POST
PATH_INFO : /wwv_flow.show
SCRIPT_NAME : /pls/dmt
REMOTE_ADDR : 148.132.152.59
SERVER_PROTOCOL : HTTP/1.1
REQUEST_PROTOCOL : HTTP
REMOTE_USER : APEX_PUBLIC_USER
HTTP_CONTENT_LENGTH : 416
HTTP_CONTENT_TYPE : application/x-www-form-urlencoded
HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
HTTP_HOST : dummyserver.com.au:7780
HTTP_ACCEPT : */*
HTTP_ACCEPT_ENCODING : gzip, deflate
HTTP_ACCEPT_LANGUAGE : en-au
HTTP_REFERER : http://dummyserver.com.au:7780/pls/dmt/f?p=4500:1003:4479870342920497::NO:::
HTTP_ORACLE_ECID : 1297402712:144.135.172.44:22243:0:21186,0
WEB_AUTHENT_PREFIX :
DAD_NAME : dmt
DOC_ACCESS_PATH : docs
DOCUMENT_TABLE : wwv_flow_file_objects$
PATH_ALIAS :
REQUEST_CHARSET : UTF8
REQUEST_IANA_CHARSET : UTF-8
SCRIPT_PREFIX : /pls
HTTP_COOKIE : ISCOOKIE=true; LOGIN_USERNAME_COOKIE=U123456; LOGIN_PASSWORD_COOKIE=; LOGIN_REMEMBER_ME_COOKIE=; r1=%23ALL; r2=%23ALL; r3=%23ALL; propHide=4301%2C%23ALL; WWV_FLOW_USER2=47770A7FD83D3E0A; ORACLE_PLATFORM_REMEMBER_UN=U123456:dmt; __ppFullPath=di-di; s_nr=1296902947468; s_evar18=%5B%5B%27referral%27%2C%271296902515781%27%5D%5D; SearchSettings=50,0,0,1,1,1,1,1; HTMLDB_IDLE_SESSION=11-FEB-2011 10:22:00; WWV_CUSTOM-F_955908081711180_100=739B959ED77BAFE2

3 replies on “Getting Session Environment Parameters in Oracle”

No need for a for loop, just call owa_util.print_cgi_env; without a parameter to list them all.

Leave a Reply

Your email address will not be published. Required fields are marked *