Session variable

Hello

I want to know is a way of the set/get on oracle sqlplus or vb.net session variable? How?

Thank you!

Francis SZE

Devotee wrote:
Could you please give me more detail (s) how do I set and get the session on the oracle sqlplus or vb.net database variable?

Why do you want a session variable and what is the purpose?

A PL/SQL, once loaded, package remains loaded for the duration of the session (except manual reset). This allows to use a package for the encapsulation of global session variables. For example

create or replace package SessionVariable as
  sessionID number;
  sessionState varchar2(20) := 'INIT';
  --// etc.
end;

From an external client, you simply use an anonymous PL/SQL block to set and read these variables via bind variable:

--// set a state variable
begin
  SessionVariable.sessionID := :1;
end;

--// read state variables
begin
  :1 := SessionVariable.sessionID;
  :2 := SessionVariable.sessionState;
end;

Another method, as illustrated by Alex, uses an Oracle context aka Namespace. There are 2 types of namespaces. Approved and unapproved.

Alex shows no reliable context. The customer can create and set session variables.

A context of trust is one where the procedure that is assigned to acts of context as an autoexec.bat or + .bash_profile script - where this script creates and sets session variables. For example, the procedure could connect to an LDAP server using the existing user identification information, read an additional security and role of the LDAP attribute values and create session for these variables.

This context confidence means that variables of session (for this context) is reliable because she was not defined by the client (running wild). This customer ran on the contrary this procedure and this procedure containing a code of confidence created the required session variables and assign values (which cannot trust) to these variables.

A context of trust is often used to implement VPDB (virtual private databases) in Oracle.

One last comment. The PL/SQL package approach works very well (as a namespace not approved), but does not support the use of SQL. You cannot use static package from SQL variables (unless SQL is inside PL/SQL).

An appropriate context can be used in PL/SQL and SQL.

Tags: Database

Similar Questions

  • Scripts of connection and SESSION variable.

    For decades, I've used the line "if/i ' % NomSession: ~ 0, 8% '==' ICA - tcp #" OUTPUT "to prevent login scripts running on Citrix servers. I also used other variants of "if/i ' % NomSession: ~ 0, 8%"=="RDP - tcp # ' and if/i"% sessionname "is" console"in scripts." Recently, these scripts began to behave badly and I discovered that the SESSION variable is no longer available when running it of login scripts. The SESSION variable does not get set until later. Once my desktop, I can open a DOS command prompt and see the SESSION variable. I suspect a fix released last month, 6/2016 led to this change in behavior. BTW, Windows XP systems do not have this problem

    I already get a work around for this, but I'm curious if anyone else has seen this and they know patch that caused it.

    FOR INFO. The solution is to add this stuffed animal at the beginning of my scripts. "

    If 'NOMSESSION % '==' ' for /F "tokens = 2" % in ("user request ^ |") "." trouver/i "% username %" ') set NOMSESSION = % f

    "

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)

    If you give us a link to the new thread we can point to some resources it
  • PHP Session variable in-app

    Hi, I'm pretty sure it's a n00bish question, but I'll have the session variable is problem when between php execs.

    So when the user connects, user id is stored in the session variable so I can use it throughout the app. However, the session variable is clearly not stored and throws a fit. I figured exit() destroys the session but that is not the case.

    I can, however, create a local variable for the user id, but I wondered how session variables are stored and retrieved.

    How is your java program interacts with the service of php?

    There is no treatment level OS things like cookies and session in Java variables.  You will have to do it yourself.

  • Bind session variables

    By trawling through the internet and this forum, I worked a little link to session variables that are defined by ADR, for example:

    Control pagination -: page_size,: page_offset,: row_offset,: row_count

    For authenticated requests -: current_user

    Body of the queries PUT and POST -: body

    It doesn't seem to be a definitive duty list anywhere, especially in the documentation accompanying the ADR.  If anyone knows of such a list?

    Hi RHARDEY,

    I pretty much like the list here: http://www.smartdogservices.com/oracle-applications-integrations/ords-use-case-integrating-salesforce-com-customers-ebs/

    Seems fairly complete. Although from my experience the following request headers DON'T work with RESTful services that you define in the APEX sql workshop, in the ADR 3.0 repository:

    -x-apex-base

    -x-apex-path

    -x-apex-charset

    -x-apex-method

    -x-apex-favorite-content-type

    But you can retrieve directly from owa_util.get_cgi_env (). They are called just differently there. But with owa_util.print_cgi_env, you can see all the available variables.

    X-apex-status and x-apex-forward response headers still work in the repository of the ADR.

    Hope that helps,

    ~ Dietmar.

  • Session Variable Multiple of the default initializer

    Hello

    I created a session variable in the RPD to default to a guest of dashboard of Department, for a set of users, to their competent services that they are responsible.

    My question is; If the session variable returns no row, is there a way to define initialization by default to select all values in the prompt the Department dashboard? I've been successful by setting default initialization as a value unique Department.

    Thank you

    WITH tmp AS (
    select department
    from employee_department
    where sup_full_id =UPPER('User1')
    )
    select department from tmp
    union
    select department from employee_department
    where 0 = (select count(*) from tmp)
    

    Something like that is supposed to work: If you have lines to "User1", it returns a DIFFERENT one on this list, if nothing is there returns you all values (with a separate as well thanks to the UNION).

  • To dynamically set values as session variables

    Hello guys,.

    I have a little problem with dynamically fixed values for text fields in my application. It is possible to set and passes the value even though I assign values, using the source (static, sql or other) but if I change the value in this field using a dynamic action it will not pass these values where I need. It shows a blank State, even if they are visible. Is there any solution to get these values passed as session variables.

    Kind regards.

    -shashikahk-

    Looks like you need to investigate the use of the property "items to submit Page.

  • Branch to the same page with different session variables

    Hello guys,.

    Is there a way that allows to create a branch that redirect to the same page with a different set of values for session variables. Or is it an effective way to add the buttons after that moves through the consecutive records in the pre and oracle apex.

    hope someone can help me.

    Kind regards.

    -shashikahk-

    is there a way to add the following buttons and pre

    If you create a form using the wizard pages, Apex will automatically create these buttons in some cases (as in a master form / retail).

    Create a master page / detail demo so you can see how it works. Apex creates a pre-rendering process:

    Get the value of the primary key next or previous

    Some of the hidden objects, such as Pxx_ROWID_NEXT.

    And two buttons: GET_PREVIOUS_ROWID and GET_NEXT_ROWID

    (if you do not use rowid as the primary key, another name will be generated).

  • Cannot get the value of the session variable (using row wise initialization).

    Hi all

    I have a scenario where I'm trying to get the value of the variable session of two columns.

    Table of database consists of the name of USER, Country_Region, columns Country_SubRegion.

    For example: ChadraKanth, Americas, America West is the data.

    I wrote a Sql query in the block of session initialization:

    Select "CR", Country_Region, Country_SubRegion

    of row_wise_init

    where USERID = ": the USER"

    When I test the RPD code gives the result like this:

    CR WesternAmerica of Americas.

    In my report I have two columns, a region and an another subregion.

    When I try to filter with the session variable "CR" for the column region his error giving: session variable is not initialized with

    This is the default.

    Question:

    1. session variable is contains several values in the column?

    2. how to filter the report on columns of region and sub region?

    Please suggest me.

    Kind regards

    Chandra Khalil.

    Hello

    A session variable cannot store more than one column, 1 variable = 1 value (column 1), horizontal initialization allows to store several lines, multiple values in the same variable.

    If to a user, you have several lines with multiple values, you need horizontal initialization, but it cannot store in the variable the value of the region and subregion.

  • ADF refresh page with page fragments jsff jsf after the set session variable

    Hello.

    I have a model that includes a button that allows you to select a profile, you push the button appear available profiles, choose one and press to accept. After that, I put a variable session successfully.

    I have a page of 'First' of jsf with two fragments of page jsff after seeing a link. The display link is composed by a headerView and detailView. The headerView had a variable binding. What I need, is that this parameter (bindVariableParameter) can be defined by the session of the model variable.

    That's what I get:

    I am in a homepage (separate Application Module), model button is pushed until I load "first" jsf page and after that, I go to the page jsf 'First', that information is loaded successfully. What I do in the Application Module is something like this:

    protected void prepareSession (one session) {}

    SessionScope card = ADFContext.getCurrent () .getSessionScope ();

    Company string = (String) sessionScope.get ("compId");

    System.out.println ("Default Comapny in British Colombia is:" + company);

    super.prepareSession (session);

    this.getSession () .getUserData () .put ("The company", company);

    System.out.println ("after the definition userData value card BC");

    }

    And in the variable binding expression of the headerView that I use:

    adf.userSession.userData.Company

    It works very well! But!

    When I press the button again and I chose another profile, the info is not updated. In the headerView or in the detailView.

    Also, when I go to the 'First' jsf page (without previously pressing the button model), I had no info, which is just, because I have no session variable. After I have press the model and select the profile, but the page is not refreshed.

    I tried many ways to this, but I'm lost.

    Could you help me?

    Kind regards.

    I'm not sure that understand your use case. What do I get, you set a parameter after that you press a button on the home page to pass this parameter to the first.jsf.

    Why don't you implement a method of the application module and call it directly with the parameter. The session of preparation will not be called whenever you browse but only init am.

    Do you need the parameter in the layer model or only in the display?

    Timo

  • How to make a column with the session variable

    Hi Experts

    I want to do something like this "DOMAIN". "Sun -"Dim - calendar VALUEOF(NQ_SESSION.'CAL_TYPE2'). "' Year '.

    But I get this error: [nQSError: 27009] unresolved identifier: "DOMAIN". «Dim - VALUEOF (NQ_SESSION. 'CAL_TYPE2') calendar ".» Year. "

    Help, please

    Concerning

    Monwabisa

    Hello

    Having several physical tables is a good news that you can move your 'dynamic' part in the physical layer.

    You simply create a single physical table and configure to have a dynamic name, the name may come from a session variable.

    This way you will point to one of your 7 calendars based on the value of the variable...

  • by the way the Session variable of type DATE for opaque filter data view

    Hello world

    You guys can help me please by passing the session variable of DATE in physical layer 'view opaque' data type filter RPD to Oracle database

    I tried following syntax, syntax wise, I didn't get any error, but at the same time this opaque view is not fetch all the records as well. my session variable is 'End_date' and its value is 1998/12 / 31:00:00:00(as_shown_in_RPD_session_windows,_datatype_is_DATETIME)

    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, SH. SALES TIME_ID

    WHERE TIME_ID = TO_DATE (' VALUEOF (NQ_SESSION.) END_DATE) ", ' MM/DD/YYYY')"

    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, SH. SALES TIME_ID

    WHERE TIME_ID = TO_DATE (' VALUEOF (NQ_SESSION.) ("' END_DATE ')", ' MM/DD/YYYY') "

    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, SH. SALES TIME_ID

    WHEN TRUNC (TIME_ID) = TO_DATE (' VALUEOF (NQ_SESSION.) ("' END_DATE ')", ' MM/DD/YYYY') "

    In the past, I could spend a session variable in an opaque display by using the DATE filter, but which was in DB2.

    I appreciate your time and help

    Finally, I had good format. It's here

    TO_DATE (substr ("valueof (NQ_SESSION. End_date)', 1, 10), "yyyy-mm-dd")

    and here is the source where I got this information

    Using Variables in Session OBIEE in some tables of the physical layer

  • OBIEE 11g - the session variable, NQ_SESSION. VARIABLE, has no definition of value

    Hello

    I see a strange problem when using the SESSION variable in OBIEE 11 g SPR for the level of data security.

    The RPD, I created a new block with the PRODUCT session variable init and wise initialization line is defined.

    SQL -SELECT DISTINCT 'PRODUCT', product_id OF BI_SECURITY WHERE UPPER (USER_ID) is UPPER(':USER')

    Condition of data filter is defined on the tables & Dimension in the application role

    Filter data based on products assigned to the user in the security table is applied.

    User A has produced 15 assigned ID

    User B has 100 product ID assigned

    The user was able to connect to the presentation of OBIEE and see assigned product ID are filtered in the report.

    But when a user B signs he sees below error, when you run the same report

    [nQSError: 23006] The session variable, NQ_SESSION. PRODUCT, has no value definition

    Is there a limit on the number of values in session variable can contain.

    Why the error occurs only for user B?

    Has anyone encountered this problem?

    Thank you

    We found there is nothing in the list of the product id is assigned to user B, so report OBIEE failed with [nQSError: 23006]

    Adding a NULL value is NOT fixed INIT SQL block this problem with access from user B.

  • How to add an extra session variable to authenticate the connection

    Hello

    IM totally new to php and dreamweaver develop a web application that uses the user name and password to authenticate the connection, and works very well. My question is, how do I add an extra session variable to capture another field in the users table for example type to redirect some pages based on the value of the type?

    If you're completely new to Dreamweaver and PHP, it sounds as if you're using Dreamweaver server behaviors. Take a friendly piece of advice and stop using the server now behaviors. They have been removed from Dreamweaver CC a couple of years because they use functions that had to be stripped on the next version of PHP. This version (PHP 7) was released in November. If you rely on Dreamweaver server behaviors, you are living on borrowed time. For a person to debut, it makes no sense to learn how to use a dead technology. The server behaviors work only in PHP 5. As soon as your server is upgraded to 7 PHP, you will have to start all over again. To understand the problem, see the following page in the PHP online documentation: PHP: Introduction - manual.

    If you want Dreamweaver to generate the code for you, you will need to use (paid-for) third-party extensions, such as those created by DMXZone or WebAssist. You can also learn how to write PHP code yourself. It is not as difficult as it sounds.

    To create a variable session, just to assign a value to an element in the superglobal array $_SESSION:

    $_SESSION ["$myvariable"] = "value";

    Session variables are available only on the pages that begin with session_start().

  • Level security line with session variables, not recommended?

    Hello

    We are on the point of implement security level line in our project of BI using OBIEE, and the solution that we found more convenient to our requirement was to use session with blocks of initialization variables.

    The problem is that this method is listed as "not recommended" in the Oracle documentation.

    Administration of alternative security options - 11g Release 1 (11.1.1)

    (This appendix describes alternative security administration options included for backward compatibility with improved systems and are not considered a best practice.)

    The Session Variables management

    Session system variables get their values of initialization blocks and are used to authenticate Oracle Business Intelligence users against external sources such as LDAP servers or database tables. Each active session of BI server generates session variables and initializes them. Each instance of session variable can be initialized to a different value. For more information on the use of variables and blocks of Oracle Business Intelligence session initialization, see 'Use of Variables in Oracle's BI repository' in Oracle Fusion Middleware metadata repository Builder of Guide for Oracle Business Intelligence Enterprise Edition.

    How confused... What is the best practice then?

    Thank you for your help.

    Joao Moreira

    authentication / authorizing the part is dealing with weblogic and then initialized the variable USER and you can use it for any initblocks for safety.

    Block of init to authenticate / variable session and authorization are different, I guess that you mix the two.

  • The session variable, NQ_SESSION. has no definition of value. (HY000)

    Hi all

    I use OBIEE 11.1.1.6.8 version and have deployed version 6.0 of BASEL RPD. When I go to the dashboard I get the below error

    Error
    View display error

    ODBC driver returned an error (SQLExecDirectW).

    http://192.168.1.18:9704/analytics/res/sk_blafp/common/errorminus.gifError details

    Error codes: OPR4ONWY:U9IM8TAC:OI2DL65P:OI2DL65P

    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 23006] The session variable, NQ_SESSION. RPB_Tier1Capital, has no value definition. (HY000)

    SQL published: {call NQSGetQueryColumnInfo ("SELECT saw_0 FROM ((SELECT sum ("head of Accounting Standard in fact"." Standard Accounting head amount "(/1000000) saw_0,"Head of Accounting Standard"". "" Saw_1 head Accounting Standard identifier', '-D2061Legal entity Info "." Customer First Name' saw_2, VALUEOF (NQ_SESSION. RPB_Tier1Capital) saw_3, saw_4 3, '-Dimension Run D1008 '. " Run the Description ' | » -'' || CAST ('-D1008 run Dimension '. ' ") (Run surrogate key' AS VARCHAR (10)) saw_5 'Basel' WHERE ('head of Accounting Standard". ("' Chief Accountant standard identifier" = "CAP058") AND ("-D001 Date Dimension". "") (Date of extraction "=" 2013-10-04 ") AND (" '-D2036 Type of Cosolidation legal entity "". "") Basel consolidate Option Type Description"(" GROUP")) AND ("-Info entity D2061Legal "." ") (Client name' IN ("*) nqgtn(*'')) AND (" "-Dimension run D1008" "." ") Run the Description ' | » -'' || CAST ('-D1008 run Dimension '. ' ") (((Run surrogate key' AS VARCHAR (10)) IN ('Basel II Capital calculation-97000106'))) UNION (SELECT sum ("head of Accounting Standard in fact". "Standard Accounting head amount"(/1000000) saw_0, "Head of Accounting Standard" "." " Saw_1 head Accounting Standard identifier', '-D2061Legal entity Info "." Customer First Name' saw_2, VALUEOF (NQ_SESSION. RPI_TotalEligibleCapital) saw_3, saw_4 4, '-Dimension Run D1008 '. " Run the Description ' | » -'' || CAST ('-D1008 run Dimension '. ' ") (Run surrogate key' AS VARCHAR (10)) saw_5 'Basel' WHERE ('head of Accounting Standard". ("' Chief Accountant standard identifier" = "CAP210") AND ("-D001 Date Dimension". "") (Date of extraction "=" 2013-10-04 ") AND (" '-D2036 Type of Cosolidation legal entity "". "") Basel consolidate Option Type Description"(" GROUP")) AND ("-Info entity D2061Legal "." ") (Client name' IN ("*) nqgtn(*'')) AND (" "-Dimension run D1008" "." ") Run the Description ' | » -'' || CAST ('-D1008 run Dimension '. ' ") (((Run surrogate key' AS VARCHAR (10)) IN ('Basel II Capital calculation-97000106'))) UNION (SELECT sum ("head of Accounting Standard in fact". "Standard Accounting head amount"(*100) saw_0, "Head of Accounting Standard" "." " Saw_1 head Accounting Standard identifier', '-D2061Legal entity Info "." Customer First Name' saw_2, VALUEOF (NQ_SESSION. RPB_Tier1CapitalRatio) saw_3, 6 saw_4, '-Dimension Run D1008 '. " Run the Description ' | » -'' || CAST ('-D1008 run Dimension '. ' ") (Run surrogate key' AS VARCHAR (10)) saw_5 'Basel' WHERE ('head of Accounting Standard". ("' Chief Accountant standard identifier" = "CAP214") AND ("-D001 Date Dimension". "") (Date of extraction "=" 2013-10-04 ") AND (" '-D2036 Type of Cosolidation legal entity "". "") Basel consolidate Option Type Description"(" GROUP")) AND ("-Info entity D2061Legal "." ") (Client name' IN ("*) nqgtn(*'')) AND (" "-Dimension run D1008" "." ") Run the Description ' | » -'' || CAST ('-D1008 run Dimension '. ' ") (((Run surrogate key' AS VARCHAR (10)) IN ('Basel II Capital calculation-97000106'))) UNION (SELECT sum (case where "Accounting Standard head".)) «Standard accountant Chief identifier "=" CAP090 "then"fact head of Accounting Standard".» "" Flat rate of chief accountant "when

    Can someone help me please. I'm new and I have no experience with the available filters.

    The session variable, NQ_SESSION. has no definition of value. (HY000)


    This means that your init block does not work. Check the init block why its not leading is not to any data.

    only when the init block fails in the data, the server checks for the default value of the variable.

    Since there is no default value, you get this error.


    Init blocks can fail because

    1 connection pool does not work.

    2. the table or view does not exist

    3. no data in the table

    4. the filter in the sql in init block is not initialized if his coming of another variable of session.


    in general, no data should bring no results in a report.

    Since you have a session variable as part of the report, and this variable initialization failed, you get this error.

  • Can I use session variables in data model BI publisher SQL query?

    Hi Experts,

    We apply security at the level of the BI Publisher 11g data.

    In OBIEE we do so using session variables, so I wanted to just ask if we can use the same session variables in BI Publisher as well
    That is, we can include a where clause in the SQL for the sample data as

    Where ORG_ID = @{biServer.variables ['NQ_SESSION.]} {[INV_ORG']}

    I would like to know your opinion on this.

    PS: We implement security EBS r12 in BI Publisher.

    Thank you

    Read this-> OBIEE 11 g: error: "[nQSError: 23006] the session variable, NQ_SESSION.» LAN_INT, has no definition of value. "When you create a SQL query using the session NQ_SESSION variable. LAN_INT in BI Publisher [ID 1511676.1]

    Follow the ER - BUG: 13607750 -NEED TO be able TO SET up a SESSION IN OBIEE VARIABLE AND use it IN BI PUBLISHER

    HTH,
    SVS

Maybe you are looking for