USERENV??
Could anyone tell me what userenv is supposed to be? It is not a function as far as I can see but is included in the where clause for the ap_expense_reports_headers view for 11i.
I am trying to import expense reports into ap from the ap_expense_reports_headers_all table but it errors out saying it cannot find any invoices. I feel that the fact that the view does not display anything might have something to do with this.
Cheers muchly
USERENV is there only for backward compatibility.
http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96540/functions162a.htm#1019148
http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96540/functions122a.htm#1038178
Similar Messages
-
When userenv('CLIENT_INFO') return too much information?
We just applied some oracle patches and now when when I do a "select trim(userenv('CLIENT_INFO')) from dual", I am getting PETERRA:1389409584404465. All I want/need is JUST the user name (PETERRA). This worked before our DBAs applied the patch(es).
Is there a setting I can change to only get the user name - not the "extra" information?
Please advise.SleepDeprivedInSeattle wrote:
We just applied some oracle patchesWhat patches?
and now when when I do a "select trim(userenv('CLIENT_INFO')) from dual", I am getting PETERRA:1389409584404465. All I want/need is JUST the user name (PETERRA). This worked before our DBAs applied the patch(es). See +{message:id=10387545}+ : this appears to be a bug or undocumented change in behaviour introduced at some point between 3.0.0 and 4.1.1.
It's not just the length/additional data, its the difference between the information returned by <tt>CLIENT_INFO</tt> and <tt>CLIENT_IDENTIFIER</tt> (builder session ID and runtime app session ID?)
Oracle didn't respond to that thread.
Is there a setting I can change to only get the user name - not the "extra" information?Not that I'm aware of. Can you trim off the extra info? -
NLS_DATE_FORMAT in NLS_SESSION_PARAMETERS and USERENV is different
I have got two databases which were created by two different DBA teams.
When I run a package it ran successfully on ORASID1 but failed on ORASID2 with ORA-01861: literal does not match format string. I've found that the query in question is trying to apply a TO_DATE() function on a DATE type column.
Now, my question is: Why the same code didnot fail on SID1.
When I compared the NLS_DATABASE_PARAMETERS, NLS_INSTANCE_PARAMETERS, NLS_SESSION_PARAMETERS, then I did not find any difference.
But, when I checked the NLS parameters using the below query, I found that the NLS_DATE_FORMAT is different.
Note: I checked all the aforesaid settings from sqlplus prompt on the Unix box.
SELECT
SYS_CONTEXT('USERENV','NLS_TERRITORY') nls_territory,
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','LANGUAGE') language
FROM DUAL;
ORASID1 NLS Settings:
NLS Territory:AMERICA
NLS Currency:$
NLS Date Format:DD-MON-RR
NLS Date Language:AMERICAN
NLS Sort:BINARY
Language:AMERICAN_AMERICA.UTF8
ORASID2 NLS Settings:
NLS Territory:AMERICA
NLS Currency:$
NLS Date Format:YYYY-MM-DD HH24:MI:SS
NLS Date Language:AMERICAN
NLS Sort:BINARY
Language:AMERICAN_AMERICA.UTF8
Could someone please explain how come the values in nls_session_parameters table are same but when the same value is checked from userenv it shows different results for NLS_DATE_FORMAT?
Thanks in advance.To be precise, the result of your query was something like this:
ON ORASID1:
AMERICAN === DD-MON-RR
AMERICA === DD-MON-RR
$ === DD-MON-RR
AMERICA === DD-MON-RR
., === DD-MON-RR
GREGORIAN === DD-MON-RR
DD-MON-RR === DD-MON-RR
AMERICAN === DD-MON-RR
BINARY ==== DD-MON-RR
HH.MI.SSXFF AM === DD-MON-RR
DD-MON-RR HH.MI.SSXFF AM === DD-MON-RR
HH.MI.SSXFF AM TZR === DD-MON-RR
DD-MON-RR HH.MI.SSXFF AM TZR === DD-MON-RR
$ === DD-MON-RR
BINARY === DD-MON-RR
BYTE === DD-MON-RR
FALSE === DD-MON-RR
ON ORASID2:
AMERICAN === YYYY-MM-DD HH24:MI:SS
AMERICA === YYYY-MM-DD HH24:MI:SS
$ === YYYY-MM-DD HH24:MI:SS
AMERICA === YYYY-MM-DD HH24:MI:SS
., === YYYY-MM-DD HH24:MI:SS
GREGORIAN === YYYY-MM-DD HH24:MI:SS
YYYY-MM-DD HH24:MI:SS === YYYY-MM-DD HH24:MI:SS
AMERICAN === YYYY-MM-DD HH24:MI:SS
BINARY === YYYY-MM-DD HH24:MI:SS
HH.MI.SSXFF AM === YYYY-MM-DD HH24:MI:SS
DD-MON-RR HH.MI.SSXFF AM === YYYY-MM-DD HH24:MI:SS
HH.MI.SSXFF AM TZR === YYYY-MM-DD HH24:MI:SS
DD-MON-RR HH.MI.SSXFF AM TZR === YYYY-MM-DD HH24:MI:SS
$ === YYYY-MM-DD HH24:MI:SS
BINARY === YYYY-MM-DD HH24:MI:SS
BYTE === YYYY-MM-DD HH24:MI:SS
FALSE === YYYY-MM-DD HH24:MI:SS -
About Audsid and userenv('sessionid')
Hi All,
I think the AUDSID of v$session view and the userenv('sessionid') will have the same value. But i want to know how the number is generated, like, will it follow a number sequence from the first startup of a database since it has been created or something else. Will it be unique for the whole database lifetime.
And wat about the SID coloumn in v$session and how it tracks the session id.
Thanks in Advance
Chikkiwill it be unique for the each session connecting to the database,
for the whole life time of the database.Probably no, MAX_VALUE = 2000000000 and CYCLE_FLAG = 'Y' means that when it reaches 2000000000 it restarts with 1.
Is there any way to reset itI wouldn't go around the dictionary, but you might change it, e.g.
SQL> alter sequence AUDSES$ maxvalue 1E27;
MAXVALUE Specify the maximum value the sequence can generate. This integer value can have 28 or fewer digits. MAXVALUE must be equal to or greater than START WITH and must be greater than MINVALUE. -
Userenv('LANG') in where clause
Would the use of userenv('LANG') in where clause cause the whole sql to not use indexes? The exact sql is at the end of this and I am seeing full table scan for one of the tables. By the way, this was after running SQL Tuning profile in Grid.
Regards,
SELECT items.cross_reference ITEM , to_number(null) ITEM_ID , nvl(items.description, T.description) ITEM_DESCRIPTION , B.inventory_item_id INVENTORY_ITEM_ID , items.cross_reference_type ITEM_IDENTIFIER_TYPE ,NULL item_identifier_type_meaning ,B.concatenated_segments INVENTORY_ITEM , NULL ADDRESS , NULL CUST_ADDRESS , NULL ITEM_DEFINITION_LEVEL FROM mtl_cross_reference_types types , mtl_cross_references items , MTL_SYSTEM_ITEMS_TL T , MTL_SYSTEM_ITEMS_B_KFV B WHERE (types.disable_date is null or types.disable_date>sysdate) and types.cross_reference_type = items.cross_reference_type AND items.inventory_item_id = B.inventory_item_id AND B.organization_id = :15 AND B.INVENTORY_ITEM_ID = T.INVENTORY_ITEM_ID AND B.ORGANIZATION_ID = T.ORGANIZATION_ID AND T.LANGUAGE = userenv('LANG') and B.customer_order_enabled_flag='Y'Thanks Yingkuan; I have 10.1.0.5; I did a little test of my own and ran tkprof with explain plan on both the scenarios; they are exactly same. So seems userenv('LANG') vs putting string like 'US' does not make any change.
Thank you for your quick response.
Regards, -
Function sys_context('USERENV','CLIENT_IDENTIFIER') Returns ANONYMOUS
our application codes has custom fine grain access control that looks for certain id's such as the userid and machine identifier. some of the codes rely on this sys_context('USERENV','CLIENT_IDENTIFIER') function to compare it's return result to some custom account reference table. one of the server machine that we recently use for testing purpose of new version for Oracle Reports is returning this ANONYMOUS result when the sys_context('USERENV','CLIENT_IDENTIFIER') is queried. this cause issue to our application.
normally, the sys_context('USERENV','CLIENT_IDENTIFIER') returns a null value when it can't recognize of find. how do i resolved it on the server to return the correct result? is there any config file that i should look into? please advise.
our test server machine is running on a Microsoft Windows XP [Version 5.1.2600].
thanks,
warrenSYS_CONTEXT('userenv','LANG') returns the Oracle short language name/abbreviation, this id may or may not correspond to the ISO language code.
Table A-1 http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14225/applocaledata.htm#g679875" in the Globalization Support guide lists all the Oracle language abbreviations.
To obtain the ISO code, you can try calling the UTL_I18N.MAP_LOCALE_TO_ISO function( ), which is available in 10g.
http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_i18n.htm#sthref14725 -
Hi ,
I am using below query in my procedure. Can it possible below query give NULL. If yes then which Case...?
SELECT SYS_CONTEXT('USERENV','OS_USER')
FROM DUAL
Thanks lot..
Edited by: user8568838 on Mar 1, 2011 2:05 AM
Edited by: user8568838 on Mar 1, 2011 2:27 AMBluShadow wrote:
smon wrote:
Please apologize and remove the word 'Urgent'.lol, lighten up!It's not about lightening up, it's about people coming here and being rude by assuming everyone should drop what they're doing to help them "urgently". You would consider it rude if you were busy talking to people in a room and someone came in demanding your urgent attention without consideration for what you're doing.
I've now edited the subject line to remove the "urgent" from it.That isn't the intention, to get everyone to drop what they're doing. Marking it as urgent just means the clocks ticking at his end, he isn't haughtily making demands of me, you or anyone else.
The meeting room analogy doesn't work, as the poster isn't barging in and disturbing us from whatever else we're doing. He's passively posting on a forum, and we're actively looking for his, or anyone elses posts, to read and reply to. If I'm busy doing something else, then the poster with the urgent problem isn't disturbing me, because I'm not on the forum. -
Parameter in SYS_CONTEXT('USERENV'
Hi,
is there any parameter in SYS_CONTEXT('USERENV' that shows the name or IP adresse of database server ( machine on which DB is running) ?
many thanks.
I know the followings but non lets know (but if I'm wrong).
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,
SYS_CONTEXT('USERENV','CURRENT_SQL') current_sql,
SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER') client_identifier,
SYS_CONTEXT('USERENV','GLOBAL_CONTEXT_MEMORY')We have 10g and 9i DBs. We should be able to know to which machine user is connected.
Thank you.
On 9i I tested :
SQL> select SYS_CONTEXT('USERENV','hostname') from dual;
select SYS_CONTEXT('USERENV','hostname') from dual
ERREUR à la ligne 1 :
ORA-02003: invalid USERENV parameter -
hi master
sir i use this command for user ip address
SELECT sys_context('userenv', 'host'), sys_context('userenv', 'ip_address') FROM dual;
BUT
form6i give me this error
Error 201 at line 26, column 12
Identifier SYS_CONTEXT must be declared
please give me idea how i get ip_address in form
thankthank for your reply
sir my need is
i check user computer name if that computer in table then i update the user feeding ouer wise i insert that computer name as new and give the feeding form access to user
you see my code
SELECT sys_context('userenv','host'), sys_context('userenv', 'ip_address') INTO HOSTNAME,IPADD FROM dual;
SELECT COUNT(*) INTO USERCOUNT FRoM forclosingyear WHERE HOSTNAME=HOSTNAME AND IPADD=IPADD;
IF USERCOUNT>0 THEN
update forclosingyear SET YEARID=:SYID,datefrom=:ysdate,dateto=:yedate WHERE HOSTNAME=HOSTNAME AND IPADD=IPADD;
ELSIF USERCOUNT=0 THEN
INSERT INTO forclosingyear (YEARID,datefrom,dateto,HOSTNAME,IPADD) VALUES (:SYID,:ysdate,:yedate,HOSTNAME,IPADD);
END IF;
this is my need
please give me idea how i get termenal name or user computer name
thank
aamir -
Hi GURUS,
I m new to oracle here i created a table in oracle 10g(10.1.0.2.0) named
create table iv_master(
iv_code varchar2(6) not null,
iv_name varchar2(50) not null,
created_at varchar2(15) default substr(sys_context('userenv','ip_address'),1,20),
created_on date default sysdate,
created_by varchar2(5) not null,
modified_at varchar2(15) default substr(sys_context('userenv','ip_address'),1,20),
modified_on date default sysdate,
modified_by varchar2(5) not null,
constraint iv_master_pk primary key(iv_code))
Now i want to remove this 'default' keyword in created_at & modified_at fields
i tried alter table command but it is not working.tell me the way to remove this default keyword and also in created_on ,modified_on..(without dropping the table)
i tried the following statement,
create table test (ipaddr varchar2(20) SUBSTR(SYS_CONTEXT('USERENV','IP_ADDRESS')1,20));
but i m getting.this following error
ERROR at line 1:
ORA-00922: missing or invalid option
pls tell me where i m wrong...and also tell me the query to do it...
Advance thanks for all...Hi,
bharathit wrote:
Hi GURUS,
I m new to oracle here i created a table in oracle 10g(10.1.0.2.0) named
create table iv_master(
iv_code varchar2(6) not null,
iv_name varchar2(50) not null,
created_at varchar2(15) default substr(sys_context('userenv','ip_address'),1,20),
created_on date default sysdate,
created_by varchar2(5) not null,
modified_at varchar2(15) default substr(sys_context('userenv','ip_address'),1,20),
modified_on date default sysdate,
modified_by varchar2(5) not null,
constraint iv_master_pk primary key(iv_code))
Now i want to remove this 'default' keyword in created_at & modified_at fieldsYou can't have the default functionality without the "DEFAULT" keyword.
Are you saying that you no longer want a default value? That's the same as saying DEFAULT NULL, and you can change the table like this:
ALTER TABLE iv_master
MODIFY ( created_at DEFAULT NULL
, modified_at DEFAULT NULL
);Edited by: Frank Kulash on Feb 17, 2010 12:59 PM
Changed ALTER TABLE example to modify both columns. -
SELECT SYS_CONTEXT ('userenv', 'ip_address') FROM dual;
I am using the following query
SELECT SYS_CONTEXT ('userenv', 'ip_address') FROM DUAL:
and the retuned row is blank.
Any Idea why?SELECT SYS_CONTEXT ('userenv', 'ip_address') FROM dual
will return the IP address of the client of the current session. If the current session is connected to a local database (i.e. not using SQL*NET), then this query appears to return NULL.
SELECT SYS_CONTEXT ('userenv', 'host') FROM dual
will return the host name from which the client is connected, even if the client is connected locally.
If the host name is not sufficient, then I'm not sure what your other options are (perhaps writing a java stored procedure which returns the IP address of the database server? always connecting via SQL*Net?) -
Relation between AUDSID and USERENV('SESSIONID')
please can someone tell me the relation between AUDSID and USERENV('SESSIONID') , i was trying to understand the below query.
SELECT USERNAME,PROGRAM into session_var,prog FROM V$SESSION WHERE AUDSID = USERENV('SESSIONID') and USERNAME is not null;can someone tell me the relation between AUDSID and USERENV('SESSIONID')What is unclear with that?
userenv('SESSIONID') (which should actually be replaced with sys_context('userenv','sessionid')) returns »The auditing session identifier«, which is the same as v$sessions.audsid. -
Not matching the SYS_CONTEXT('USERENV', 'LANG') with oracle fod schema data
I have imported the fod schema into oracle XE. I observed that the data available for following languages:
SQL> select distinct language from category_translations;
LANGUAGE
EN
EL
FR
DE
JA
But, when I check the value for the LANG in oracle XE, it is returning as 'US'.
SQL> select SYS_CONTEXT('USERENV','LANG') FROM DUAL;
SYS_CONTEXT('USERENV','LANG')
US
Becasue of this, I am not getting data when I run VOs from JDeveloper. Even I am not able to see data from FOD schema views.
Please suggest what changes I need to do for getting data.Try this,it will work
alter session set nls_language = 'GREEK'
If the above query is used,it will set the current session's language code to 'GL' which is valid in the language filed of category_translations.
I did not find any nls_language value to get the 'EN' code.
You can get the valid language values from the below query:
select * from V$NLS_VALID_VALUES where parameter='LANGUAGE'
Thanks,
Mohan -
Getting client name using userenv('terminal') when use of TERMINAL SERVER
Hi all,
Is there any way we can get client computer name when we use terminal server. userenv('terminal') giving server name only. How can I get client computer name.
Thanks in advancethe report-forum is here :
Reports -
Re: How to set userenv('LANG') value
HI SumitSharma ,
I will go into your similar solution , did you get the conclusion of whether the application setting of 'Current Session Language' in Preference, can pass into the database session or not.
Thanks
RayleeHi Hussein,
Thank you for the metalink Note reference. It was indeed helpful.
However a small question remains. When we set the 'Default Application Language' or the 'Current Session Language' in Preferences (for the Oracle Apps login), where does it get stored. I understand that the language changes accordingly, but does that updated language reflect in userenv('LANG') once a query runs on the server (in a Report).
Please excuse my ignorance.
Regards
Sumit
Maybe you are looking for
-
FBB1: group currency not been valuated
Hi Experts, kindly provide solution to my issue i am facing during foreign currency valuation thru FBB1. Issue: Group currency not updated during FC revaluation in Netherlands company code. company code currency: EUR CO Area currency: EUR (30, group
-
Why can't I download Premiere Pro?
I don't seem to have the option to download Premiere Pro trial version?
-
Change documents for maintenance plan_item level
Hi all, just came across a weird thing about maintenance plan change documents when you change something in your plan on item level, it doesn't get reflected in Extras/Change Documents-only those changes that made on header level.. does anybody have
-
Accessing Website on Win2000 (home network)
Hi, I have just purchased an iMac 2.0Ghz(192.168.1.5) and have got it setup & accessing the internet no problem, also i have a windows 2000 box which I can access file shares no problem. BUT i am running IIS on the windows box(192.168.1.2) and use it
-
Hi, i'd like to use JDBC connection with Mysql which is embedded in my application(not client/server version).How can i code to connect my application to such embedded server. Can anyone help me.Thanx in advance...