SYS_CONTEXT

Can any one explain me what below code do how i can check context values.
c_working_airport_predicate CONSTANT VARCHAR2 (500)
:= ' SYS_CONTEXT ('''
|| c_session_context
|| ''','''
|| c_airport
|| ''') IN '
|| '(pri_working_airport_code ,'
|| ' sec_working_airport_code)';
Thanks,

Seems like some kind of dynamic security predicate that is applied at run-time.
A context is a namespace in a session, containing name-value pairs. E.g. I can create a namespace called EMPDATA. As part of the logon processing of the session, this context gets a name-value pair called ROLE, indicating the session user's role as per HR data. The name-value pair could for example be ROLE=SUPERVISOR.
To view the value from this namespace for the attribute, role:
SYS_CONTEXT( 'EMPDATA', 'ROLE' )
Name values are typically compared with other values (from a table for example) at runtime - in order to make a query succeed or fail, or limit the data output of that query. For example, the above sys context function can be used to limit a query's output to rows only a user with supervisor access can see,
select * from some_table where col123 = SYS_CONTEXT( 'EMPDATA', 'ROLE' )
And that is what the code snippet you post does - dynamically. It gets the value from a namespace (value is in <i>c_session_context</i>) for attribute identified by c_airport. it then uses it in a predicate.
What is unusual is that the context's name is variable, and that the attribute name is also variable. This points to a possible flawed implementation/solution.

Similar Messages

  • Issue in SYS_CONTEXT function

    Dear Friends,
    I have an issue in SYS_CONTEXT function. If I run the SYS_CONTEXT function SQL query in SQL PLUS and SQL Developer Tool, the values are showing differently in both the tools.
    CASE 1: In SQL Developer Tool,
    SQL> SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') from dual;
    SYS_CONTEXT('USERENV','IP_ADDRESS')
    10.1.118.101
    SQL> SELECT SYS_CONTEXT('USERENV','OS_USER') from dual;
    SYS_CONTEXT('USERENV','OS_USER')
    Administrator
    CASE 2: In SQL * PLUS Tool,
    SQL> SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') from dual;
    SYS_CONTEXT('USERENV','IP_ADDRESS')
    192.168.12.164
    SQL> SELECT SYS_CONTEXT('USERENV','OS_USER') from dual;
    SYS_CONTEXT('USERENV','OS_USER')
    Oracle
    Important Details
    OS Login User: Administrator
    DB Connect User: Oracle
    Server IP Address: 192.168.12.164
    System IP Address: 10.1.118.101
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Release 10.2.0.1.0 - 64bit Production
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    I am using the same queries in both the tools, but the output is coming differently, Can you help me to solve the issue.
    Thanks

    IP_ADDRESS
    IP address of the machine from which the client is connected. If the client and server are on the same machine and the connection uses IPv6 addressing, then ::1 is returned.

  • Oracle Discoverer integrate with SSO, SYS_CONTEXT function does not work?

    Here is the summary of steps I have already completed:
    1. Following the Discoverer configuration guide, I modified mod_osso.conf file.
    2. So right now, when I typed
    http:\\host: 7778\discoverer\plus, it will direct me to the single-sign-on page.
    3. Then I login as "orcladmin" (a user in OID), and I will be direct to the standard Connection page.
    4. And I already create a private connection using database user "EDW".
    5. So when I click the private connection, I can run the workbook and see all the data. So far so good.
    6. Now is the problem, since I am going to use VDP to restrict the data that SSO user can see. (for example, "orcladmin" can only see school1 data, but not school2 data) So I need to use some sort of function to return value "orcladmin" in the database so that I can use it to create security context and policy (for example, when "orcladmin" login, the SQL query discoverer generated will have a where clause school_id=1). And according to the configuration guide, if I run the following SQL, I should get back "orcladmin":
    Select SYS_CONTEXT('USERENV', 'CLIENT_IDENTIFIER') from dual;
    But instead, I got null. What is the problem? BTW, when I ran the above SQL, I login into the database as EDWPRD, who owns all the base tables that underlying all the workbooks.
    Thank you in advance for your help!!
    Ren

    Hi Ren
    When you say that you are testing this in SQL presumably you are doing this in SQL Plus. If this is true then the answer you got back is correct because connections to SQL Plus do not use the App Server SSO login and so the CLIENT_IDENTIFIER attribute will always return NULL. Try switching this to OS_USER and you should see the user name from the operating system. Switching this to SESSION_USER will tell you the database user name, while switching it to TERMINAL will tell you the name of the machine that you are logged on, and so on.
    For a full list of attribute values to SYS_CONTEXT take a look here:
    http://www.psoug.org/reference/sys_context.html
    To take advantage of any of this inside Discoverer you would have to register the PL/SQL SYS_CONTEXT function with Discoverer.
    Hope this helps
    Regards
    Michael

  • How to use SYS_CONTEXT Function/procedures

    Hello, I am not familiar with this function and am trying to get a better understanding of how it works and how to find WHERE the data is being stored.
    I understand that this is an Oracle Function as well as how its parameters are used, but I don't understand where the data is stored:
    Example (my client created this query - in part):
    SELECT
    COLUMN1,
    COLUMN 2
    from TABLEA A
    where a.company = sys_context('USER_CONTEXT','SL_OJSQ_COMP_CODE')
    and a.job_code = sys_context('USER_CONTEXT','SL_OJSQ_JOB_CODE')
    and a.phase = sys_context('USER_CONTEXT','SL_OJSQ_PHS_CODE')
    and a.category = nvl(sys_context('USER_CONTEXT','SL_OJSQ_CAT_CODE'), a.category)
    I am trying to figure out how the JOIN is being used. How can I find the table/data for sys_context('USER_CONTEXT','SL_OJSQ_COMP_CODE') or maybe it is not a table/data but a package...?
    Any guidance is appreciated,

    Hello, I am not familiar with this function and am
    trying to get a better understanding of how it works
    and how to find WHERE the data is being stored.
    I understand that this is an Oracle Function as well
    as how its parameters are used, but I don't
    understand where the data is stored:
    Example (my client created this query - in part):
    SELECT
    COLUMN1,
    COLUMN 2
    from TABLEA A
    where a.company =
    sys_context('USER_CONTEXT','SL_OJSQ_COMP_CODE')
    and a.job_code =
    sys_context('USER_CONTEXT','SL_OJSQ_JOB_CODE')
    and a.phase =
    sys_context('USER_CONTEXT','SL_OJSQ_PHS_CODE')
    and a.category =
    nvl(sys_context('USER_CONTEXT','SL_OJSQ_CAT_CODE'),
    a.category)
    I am trying to figure out how the JOIN is being used.
    How can I find the table/data for
    sys_context('USER_CONTEXT','SL_OJSQ_COMP_CODE') or
    maybe it is not a table/data but a package...?
    Any guidance is appreciated,There is no JOIN in your statement.
    USER_CONTEXT is the name of an application context which is already created and should be initialized in your session. It is simply a set of attributes and your query shows some of them : SL_OJSQ_COMP_CODE, SL_OJSQ_CAT_CODE, ...
    you can query the view session_context to see attributes and values of contexts initialized in your session

  • Problem with SYS_CONTEXT in WHERE clause in 10g

    I am running the following SELECT statement in 9i and 10g
    SELECT COUNT(*)
    FROM mapinfo.mapinfo_mapcatalog
    WHERE tablename IN ('ESU_GRAPHICS', 'STREETS', 'ASD_STREETS', 'NSG_ARCHIVE_ESU_GRAPHICS')
    AND ownername = sys_context('USERENV','CURRENT_SCHEMA');
    When running in 9i it returns 4, the correct answer, but in 10g it always returns 0. I have tried populating a variable with the result from sys_context('USERENV','CURRENT_SCHEMA') such as:
    SELECT sys_context('USERENV','CURRENT_SCHEMA')
    INTO currentschema
    FROM dual;
    I have checked the variable and it is giving me the correct result in 10g, but I still get 0 returned from the select statement.
    What am I missing to get this working in 10g?
    Cheers
    Sean

    - Does the value for CURRENT_SCHEMA actually match
    the ownername column for the tables in your IN
    clause? Yes
    >
    - Is there anything different between 9i and 10g?
    E.g. did you have any fine grained access control?Not that I know of, but I am not a DBA so I could not say for sure.
    Were you setting CURRENT_SCHEMA with an ALTER SESSION
    statement in 9i that you have missed in your 10g
    environment?No we do not use any ALTER SESSION statements.
    >
    - What do you get if you run the following?
    select user from dual;
    select sys_context('USERENV','CURRENT_SCHEMA') from
    dual;
    Exactly the same result
    >
    - What do you get if you run the following?
    SELECT tablename, ownername FROM
    mapinfo.mapinfo_mapcatalog
    WHERE tablename IN ('ESU_GRAPHICS', 'STREETS',
    'ASD_STREETS', 'NSG_ARCHIVE_ESU_GRAPHICS');
    380 rows of data including the 4 that I am interested in
    - Can you also show the value of your variable when
    you use a SELECT INTO in PL/SQL... Were you using
    uppercase for USERENV and CURRENT_SCHEMA in PL/SQL
    (there was an incorrect results bug when using
    lowercase attributes in PL/SQL SYS_CONTEXT calls)?I am showing the value of the variable and it is holding the correct value, and yes I am using uppercase USERENV and CURRENT_SCHEMA.
    After more investigation it looks like it is not SYS_CONTEXT, it is using a variable in the WHERE clause. If I set the variable to a hard coded value I still get the same result. If I replace the variable for a hard-coded string in the WHERE clause I get the correct result.

  • Sys_context and Order by clause

    Hi All,
    Im using Oracle 11g R2.
    Is it somehow possible to use Context variable (to store column name) in ORDER BY clause? My ultimate aim is to construct Order by at runtime without using concatenation.
    e.g. i created context as my_ctx for some pkg and its variable as v_ctx having value set as "TABLE_NAME"
    so is it possible to use it as
    select * from all_tables
    order by sys_context('my_ctx', 'v_ctx');
    if no, is there any work around??
    Thanks,
    Vivek

    Hi, Vivek,
    Vivek wrote:
    Hi All,
    Im using Oracle 11g R2.
    Is it somehow possible to use Context variable (to store column name) in ORDER BY clause? My ultimate aim is to construct Order by at runtime without using concatenation.Sure, you can use SYS_CONTEXT in an ORDER BY clause, but it's unclear what you're trying to do, so I don't know if SYS_CONTEXT will help you.
    e.g. i created context as my_ctx for some pkg and its variable as v_ctx having value set as "TABLE_NAME"
    so is it possible to use it as
    select * from all_tables
    order by sys_context('my_ctx', 'v_ctx');
    if no, is there any work around??Post a complete test script hat people can run to re-create the problem and test their ideas. Show the output you want from the parameters an data you give.
    Think about using a CASE expression in the ORDER BY clause. You can use SYS_CONTEXT in the CASE expression if you want to.

  • SYS_CONTEXT usage taking time for first run

    Hi all,
    we have a screen(search) with conditions like make, manufacturing date, region, etc upto 20 conditions. User can restrict the result he wants based on the filters specified. As there are more parameters, a static query was takign a lot of time to return the result.
    We went with dynamic query(only adding the conditions that user has specified in the screen dynamically) and to avoid hard parsing we introduced sys_context.
    we found the result amazing with the subsequent run taking very less time(3-10 secs max) to fetch the results. But the first run (which goes for hard parsing done) is taking a quite a lot of time (close to 10mins).
    we are using Oracle 11g.
    thought this query is used on a regular basis, sometimes the sqlID gets cleared off from the cache due to LRU algorithm. Also sometimes, I see there are more than one SQL ID getting generated for the same set of parameter.
    we cannot use the sql pin option as we would need to pin the sql for every combination of parameter(around 30).
    Could anyone suggest a way of reducing the first run time?
    Thanks in advance..
    Regards,
    Ela

    >
    we cannot use the sql pin option as we would need to pin the sql for every combination of parameter(around 30).
    >
    Then try specifying 'something' for every condition and using '%' for the context values that you don't care about.
    If you don't care about 'empno' use '%' for the context value.
    select * from emp where empno like '%'If you do care use an actual value
    select * from emp where empno like '7369'The 'like' will be treated as '=' for the second case and in the first case it should be optimized out in the actual query.
    That way every query has the same 30 placeholders but the '%' will optimize out the ones you don't want to use.

  • SYS_CONTEXT not returning results

    Hi - noobie question,sorry in advance.
    I'm studying for the OCA and I've come across a function called SYS_CONTEXT
    [http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions184.htm#SQLRF06117]
    I'm trying to retrieve my own IP address by using SYS_CONTEXT('USERENV', 'IP_ADDRESS'). SQL*Plus is accepting it but returning nothing and I don't know why. I've tried a few arguments (e.g. SYS_CONTEXT('USERENV', 'AUTHENTICATION_DATA') but still nothing is returned. Always using USERENV as I believe this is the built-in namespace in Oracle.
    any advice helpful at this point.
    PS I'm connected to OracleXE as SYSTEM

    1006948 wrote:
    Hi - noobie question,sorry in advance.
    I'm studying for the OCA and I've come across a function called SYS_CONTEXT
    [http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions184.htm#SQLRF06117]
    I'm trying to retrieve my own IP address by using SYS_CONTEXT('USERENV', 'IP_ADDRESS'). SQL*Plus is accepting it but returning nothing and I don't know why. I've tried a few arguments (e.g. SYS_CONTEXT('USERENV', 'AUTHENTICATION_DATA') but still nothing is returned. Always using USERENV as I believe this is the built-in namespace in Oracle.
    any advice helpful at this point.
    PS I'm connected to OracleXE as SYSTEMDon't connect as sys or system (there's a very small number of cases in which you need to do that).
    Those accounts are "special" and shouldn't be used for day to day operations like what you are trying to do. Playing in those accounts will cause you no shortage of headaches.
    Cheers,

  • Sys_context not working from APEX application / environment

    I am struggling to retrieve a user-defined context value using sys_context(...) from APEX application / environment
    I have created a global context to be used as a storage mechanism for log severity to be recorded.
    CREATE OR REPLACE CONTEXT PA_LOGGER_CTX USING PA_LOGGER ACCESSED GLOBALLY;It is seeded through a function pa_logger.set_severity(1) within the package pa_logger through (excerpt):
      dbms_session.set_context(c_ctx_context_label, c_ctx_severity_label, TO_CHAR(p_severity_in));
      with:
      c_ctx_context_label     CONSTANT NVARCHAR2(16) := 'PA_LOGGER_CTX';
      c_ctx_severity_label    CONSTANT NVARCHAR2(8) := 'SEVERITY';
      p_severity_in   IN  PLS_INTEGERusing the following from sqlplus, other DB-tools, works as expected:
    -- setting it
    BEGIN
      pa_logger.set_severity(2);
    END;
    -- displaying it
    SELECT sys_context('PA_LOGGER_CTX', 'SEVERITY') FROM DUAL;returns 2
    This works from different sessions, different users ... no problem.
    Using it from within an APEX (accessed via embedded gateway/XE11.2 or OHS/11.2.0.2.0 ) application or even from the "SQL Commands" from the APEX Workspace returns a NULL value for :
    SELECT sys_context('PA_LOGGER_CTX', 'SEVERITY') FROM DUAL;And
       SELECT value  FROM GLOBAL_CONTEXT WHERE NAMESPACE='PA_LOGGER_CTX' and ATTRIBUTE = 'SEVERITY';returns the right value, which obviously defies the purpose of using the CONTEXT.
    It is as well possible to set the CONTEXT to a different value, which is picked up outside APEX, but even so using sys_context does not work, always returning NULL
    As a note aside: using sys_context with a standard CONTEXT, e.g. SELECT sys_context('USERENV', 'NLS_DATE_FORMAT') from DUAL works without any problems.
    I guess I have a conceptual break somewhere. Does this have to do with the APEX user used, wrapping within the APEX environment, the way the context is defined ....
    Any help is appreciated.
    Many thanks,
    - Thomas

    Hi Rod,
    Thanks for the time to answer. Meanwhile I found some more hints on the subject (Retrieve values from my own global context in Apex and I do now understand the concept.
    I understand that I can even clear the specific CLIENT_IDENTIFIER by issuing a "dbms_session.clear_identifier()", which then subsequently works
    Looking at the CLIENT_IDENTIFIER as set by APEX it is "<apex_login_user><apex_session>";
    I understand it is set for every DISPLAY-SUBMIT it is reset by the APEX framework.
    Hence it is not sufficient to set it for a user session; it needs to be changed for every display-submit. I can achieve this through application processes, but I am really reluctant to do so, because I do not know, if APEX relies on the CLIENT_IDENTIFIER to be set the way it is done. I suspect a purpose behind this, causing me problems elsewhere. I post this as a seprate question as this question has been answered.
    On to your point about: Using a table variable. This is the way it works currently, but allegedly using the CONTEXT would give us for the logging configuration a performance gain of about 1 dimension..... but unfortunately other problems..
    Thanks!
    - Thomas

  • How to view sys_context value in SQL Developer?

    hello
    i can view the results via sqlplus with following statements:
    SELECT SYS_CONTEXT ('empno_ctx', 'empno_attrib') empno_attrib FROM DUAL;
    SELECT * FROM SESSION_CONTEXT;
    both retrieve correct values;
    now, since i work mainly in SQL Developer i wanted to view the results in there as well;
    i ran the procedure in SQL Developer via right-click on the procedure -> run;
    it looked like it ran ok;
    however when i do the above queries nothing is retrieved;
    any suggestions?
    thanks
    rgds

    Hi,
    You can use
    SELECT SYS_CONTEXT ('empno_ctx', 'empno_attrib') empno_attrib into <Variable Name> FROM DUAL;
    dbms_output.putline (<Variable Name>
    So after you execute the procedure. You will be able to see the value in output window.
    Regards,
    Kushal Gupta

  • Sys_context - Error in Oracle 8 Database

    I am using sys_context but it gives error message.
    SELECT SYS_CONTEXT ('userenv', 'host') FROM dual
    ------ it gives following message
    SELECT SYS_CONTEXT ('userenv', 'host') FROM dual
    ERROR at line 1:
    ORA-00904: invalid column name
    Pl. help me urgently
    My database is ORACLE 8.

    Please post your technical questions [url http://forums.oracle.com/forums/forum.jsp?forum=61]here for quick response.
    Regards,
    Anupama
    [url http://otn.oracle.com/sample_code/]OTN Sample Code

  • SYS_CONTEXT bug in 1.5.4?

    select sys_context('userenv','OS_USER')
    from dual;...returns null for me in 1.5.4, but returns the correct value in 1.5.0.52 and SQLPlus.
    Finally explains what has been messing up my audit triggers. Back to the older version I go unless anybody has a fix.

    At first I thought that it must be the database too if it was trigger related, till I tried the same exact insert from multiple sources.
    The strange thing is that on my home laptop I'm running the same SQL Developer version (and JDK as well I think) against XE and I get the correct results from the query. I'll have to round up version numbers today, and try the OCI driver tip.
    <edit>
    Here's versions that are/aren't giving me grief.
    ===================================
    PC #1
    Database: 10.2.0.4.0
    OS: WinXP SP3
    Not Working - Oracle IDE: 1.5.4.59.40
    Java(TM) Platform: 1.5.0_12
    Java(TM) Platform: 1.6.0_07
    Java(TM) Platform: 1.6.0_12
    Working - Oracle IDE:     1.5.0.52.03
    Java(TM) Platform: 1.5.0_12
    Java(TM) Platform: 1.6.0_07
    PC #2
    Database: XE
    OS: Vista (64 bit)
    Oracle IDE:     1.5.4.59.40 - Working
    Java(TM) Platform: 1.6.0_12 (32 bit)
    ===================================
    I enabled the OCI/Thick driver for 1.5.4 as suggested (on PC#1) and that seemed to resolve it. Next time I'll run my search more than the last 90 days.
    Edited by: DylanB123 on Mar 11, 2009 11:08 PM

  • 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,
    warren

    SYS_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

  • Sys_context issue

    I need a sys_context which can be accessed globally across the instance.
    And this does just that:
    dbms_session.set_context( namespace  => 'my_ctx',  attribute  => 'key', value  => theKey)Every session can reterive the value with:
    sys_context('my_ctx', 'key') The problems comes after this:
      dbms_session.set_identifier( sessionId );Once this is issued, then getting the context stops working:
    sys_context('my_ctx', 'key') I understand why and can overcome it by resetting the context with the sessionId:
    dbms_session.set_context (  namespace  => 'my_ctx',   attribute  => 'key',  value  => theKey, client_id  => sessionId)Problem is I have some variables which are common to all and I’d rather not need to reset each one after set_identifier() is issued.
    Is there a way to grab the key value which is not associated with a sessionId?
    I've tried creating a 2nd sys_context for these instance wide globals and it behaves the same way.
    I'd like to solve this as a sys_context and not as global procedure variable. I'd like something which will not switch contexts when being used in a sql statement. Do I have to compromise and use a global temp table? The key value will not change...I have not tired a deterministic function or an authId function.....hummm, authId might work...wonder if that would cause a context switch? I'll try it now.

    sb92075 wrote:
    With any other exception code silently terminates just like normal successful completion.Really?
    SQL> declare
      2      kv varchar2(64);
      3  begin
      4      select  value
      5        into  kv
      6        from  v$parameter;
      7    exception
      8      when no_data_found then null;
      9  end;
    10  /
    declare
    ERROR at line 1:
    ORA-01422: exact fetch returns more than requested number of rows
    ORA-06512: at line 4
    SQL> declare
      2      kv varchar2(1);
      3  begin
      4      select  name
      5        into  kv
      6        from  v$parameter
      7        where rownum = 1;
      8    exception
      9      when no_data_found then null;
    10  end;
    11  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 4
    SQL>SY.

  • SYS_CONTEXT in JDeveloper

    I use sys_context and fine grain control in our application. However, sys_context doesn't seem to work fine for application running Java. My procedure to set predicate is as following:
    /* To set select predicate. */
    CREATE OR REPLACE
    FUNCTION SELECT_POLICY
    (P_OWNER VARCHAR2
    ,P_OBJECTNAME VARCHAR2
    RETURN VARCHAR2
    IS
    -- Program Data
    V_PREDICATE VARCHAR2(2000);
    -- PL/SQL Block
    BEGIN --Begin of function
    IF (sys_context('Apps','Responsibility')='Client') THEN
    v_predicate :='CLIENT_ID=sys_context(''Apps'',''Client'')';
    ELSE
    v_predicate := '0=1';
    END IF;
    RETURN(v_predicate);
    END; -- End of function;
    The function work fine in SQL* Plus, but in JSP application written using JDeveloper, the result set:
    rs = dbConnection.executeQuery("select client_id from clients");
    rs.next();
    always return no row.
    However, if we use:
    rs = dbConnection.executeQuery("select client_id from clients");
    rs = dbConnection.executeQuery("select client_id from clients");
    rs.next();
    then the result set woulc obtain correct result.
    It seems that the sys_context function doesn't work in the first query.
    I make us very inconvinient in codding because every query must be execute twice.
    If you have any idea on this, please give me a hand.
    Thanks and regards,
    Hien.
    null

    - Does the value for CURRENT_SCHEMA actually match
    the ownername column for the tables in your IN
    clause? Yes
    >
    - Is there anything different between 9i and 10g?
    E.g. did you have any fine grained access control?Not that I know of, but I am not a DBA so I could not say for sure.
    Were you setting CURRENT_SCHEMA with an ALTER SESSION
    statement in 9i that you have missed in your 10g
    environment?No we do not use any ALTER SESSION statements.
    >
    - What do you get if you run the following?
    select user from dual;
    select sys_context('USERENV','CURRENT_SCHEMA') from
    dual;
    Exactly the same result
    >
    - What do you get if you run the following?
    SELECT tablename, ownername FROM
    mapinfo.mapinfo_mapcatalog
    WHERE tablename IN ('ESU_GRAPHICS', 'STREETS',
    'ASD_STREETS', 'NSG_ARCHIVE_ESU_GRAPHICS');
    380 rows of data including the 4 that I am interested in
    - Can you also show the value of your variable when
    you use a SELECT INTO in PL/SQL... Were you using
    uppercase for USERENV and CURRENT_SCHEMA in PL/SQL
    (there was an incorrect results bug when using
    lowercase attributes in PL/SQL SYS_CONTEXT calls)?I am showing the value of the variable and it is holding the correct value, and yes I am using uppercase USERENV and CURRENT_SCHEMA.
    After more investigation it looks like it is not SYS_CONTEXT, it is using a variable in the WHERE clause. If I set the variable to a hard coded value I still get the same result. If I replace the variable for a hard-coded string in the WHERE clause I get the correct result.

  • It is possible to get NULL in SYS_CONTEXT('USERENV','OS_USER') .?

    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 AM

    BluShadow 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.

Maybe you are looking for

  • Report generation doesn't scale to fit

    The layout option, "Scale front panel to fit" in "Easy Print VI Panel or Documentation.vi" (in the report generation pallette) doesn't do anything.  In fact, if I dig into that vi, it goes through to "Report Gen VI or Documentation.vi", and I find th

  • Cannot update My itunes on my Macbook Pro.

       I Have gotten a new Ipod Touch for my birthday, and I have already set it up to my iTunes account. But when I went to sycn it is said that itunes needed to be upgraded to 10.6 or later. I went to sowftware update, and in upgraded everthing BUT itu

  • Vendor line item clearing thru f-44

    Hi guru I have posted one document through FB60 and and made credit memo thru same transaction code. When I was matching both the document trhu F-44 it is giving an error message. u201Cconsolidated companies est150 and are different u201C Message no.

  • Dynamic Interface in a Sender Agreement

    Hi all, I need to  know if It is possible to change the interface in a sender agreement in runtime. I wonder if I am able to make this change in a  module. Other thing I need to know if there is any way for make it possible that one communication cha

  • Calendar icon in my dock showing a number

    I have a MacBook Pro and the latest version of Mountain Lion. When I booted up this morning, my Calendar icon in my dock shows a "1" in the upper right hand corner. What is this, and how do I get rid of it?