To pass new session variable value to stored proc before running a report.

Hi,
Below is summary of the report requirement -
Database level design
1. Created a view and a global temporary table (GTT)
2. Created an Oracle package procedure to accept from and to business dates on basis of which it will fetch, process and populate the GTT.
Repository level design
1. Created a business model containing the view and the GTT (mentioned above)
2. Created two SESSION variables "from_dt" and "to_dt" to be initialized by their respective init blocks. Each of the variable is initialized with a DATE column value (of type DATETIME) from a database lookup table. I have also set the option "Enable that variable to be set by any user" for both variables.
Query for these variables :
from_dt = select from_date from <table>
to_dt = select add_months(from_date,12) from <table>
Presentation level design
1. Using a text box, i display the default/initialized values of these variables like this -
Current business date:@{biServer.variables['NQ_SESSION.from_dt']} Future business dt:@{biServer.variables['NQ_SESSION.to_dt']}
Dates get displayed in YYYY-MM-DD 00:00:00 format
The text msg displays these default dates and allows the user to specift different date range for which i create prompts as shown below.
2. Using any random two columns of date type from the business model, i create two date dashboard prompts with labels "From Dt" and "To Dt".
i select Calender Controls for both; setting Default To = Report Defaults.
The Set Variable is set to Presentation variables - such that pv_from_dt maps to "From Dt" and pv_to_dt maps to "To Dt".
3. i create the report using the business model created above. In the report "Advanced Tab" => "Prefix" field i specify the following -
SET VARIABLE from_dt='@{pv_from_dt}',to_dt='@{pv_to_dt}';
Note : The logic here is to display the default dates and allow user to specify different date values which will be stored in presentation variables.
If the user does specify different "from dt" and "to dt" values, then using the presentation variables, i want to "write" back these new values to the corresponding session variables mentioned above.
If the user does not specify different date range, then the default/initialized dates must be considered.
I also display the default and new date values in the report title.
Back to Repository level design
To execute the stored procedure that will load the GTT before running the report I need to pass two date parameters to the stored procedure on basis of which it will fetch data, process and populate the GTT.
In the Connection Pool --> Connection Script Tab --> Execute before query, I wrote the below query using the repository variables FROM_DT and TO_DT to execute the procedure -
DECLARE
v_from_dt date;
v_to_dt date;
BEGIN
v_from_dt := VALUEOF(From_Dt);
v_to_dt := VALUEOF(To_Dt);
package_name1.package_body(v_from_dt,v_to_dt);
END;
Now when i try to run the report i get the following error :
[nQSError: 10058] A general error has occurred. [nQSError: 23006] The session variable, NQ_SESSION.to_dt, has no value definition. (HY000)..
Need help on this.
Is it possible to "write back" a new value to a session variable ?
Any other alternatives.
Thanks
Nusrat
Edited by: user10309945 on Jan 24, 2011 10:08 PM

Sandeep, I found a several topics where users describe saving values in DB through stored procedure or function. For example, [How to store OBIEE presentation level variable values in DB |http://forums.oracle.com/forums/thread.jspa?threadID=892006] I tried it and get an error
*10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 14551, message: ORA-14551: cannot perform a DML operation inside a query ORA-06512*
It's not a BI error. This error are generated by Oracle DB. If I write next:
SELECT MyPLSQLFunction(p1,p2) FROM DUAL
I get the same error.
Oracle doesn't allow DML operations in SELECT.
Did you relalize this feature yourself? Where did I mistake?

Similar Messages

  • Passing single/multiple values to stored proc parameter from crystal report

    I tried below solution posted on this forum to pass either a single value or multi-value to a sql server stored procedure parameter (varchar datatype) from crystal report XI R2.
    In my crystal report , I am displaying all the available parameter values to the user  and the user will select either a single value or multi value.
    This worked when I select single value and when I say show sql query in my subreport  I see the following:
    {CALL "XYZ"."dbo"."storedprocedurename";1('Product  1')}
    But this did not worked when I selected multiple values and when I say show sql query in my subreport  I see the following:
    {CALL "XYZ"."dbo"."storedprocedurename";1('Product 1,Product 2')}
    I think it might work if it is as below:*
    For multiple values:
    {CALL "xyz"."dbo"."storedprocedurename";1('Product 1', 'Product 2')}
    Please advise.
    Solution Posted on this forum is as follows:
    Hi,
    As you must be aware of that a crystal report created of a stored procedure will allow only a single value for inserting a multiple value as a parameter in your report and pass those values to your stored procedure please follow the below work around which will be helpful for you.
    Symptom
    In Crystal Reports, you want to pass a multi-value parameter to a stored procedure. The problem with doing so is that Crystal Reports considers the multi-value parameter to be an array.
    How can you pass a multi-value parameter to a stored procedure?
    Resolution
    Here are the steps to pass a multi-value parameter to a stored procedure:
    1. Create a Crystal report, and add a multi-value parameter.
    2. Since the multi-value parameter is treated as an array, create a formula that uses the JOIN function. Create a formula as below:
    //Formula: @JoinFormula
    Join ({?Multi-value parameter array},";")
    ====================
    NOTE:
    In the formula above, a semi-colon (";") is the delimiter.
    ====================
    3. Within the main report, create a subreport based on the stored procedure, and include the parameter to be populated with the multi-value list.
    4. Link the Join formula in the main report to the stored procedure parameter in the subreport.
    Doing so passes a multi-value parameter to the stored procedure.
    Regards,
    Vinay

    Hi Vinay,
    First you need to make sure the stored procedure accepts multiple values in the fashion 'a','b','c'.
    Then, create this formula in the Main Report:
    numbervar i;
    stringvar s;
    for i:= 1 to ubound({?Parameter}) do
        s := s + "'" + {?Parameter}<i> + "'" + ",";
    left(s,len(s)-1);
    Link this formula to the sub-report's parameter.
    Hope this helps!
    -Abhilash

  • How to set variable values in Stored Procs

    Hi all,
    please excuse my newbie questions - I've spent too long using SQL Server......
    Anyway,
    I'm playing with SP basics and was wondering how I can set a variable value in a stored proc, ideally getting a value from a table or some select .
    for instance...........
    CREATE OR REPLACE PROCEDURE RPT_SP_ANT_TESTING
    P1 IN NUMBER,
    P2 IN VARCHAR2
    IS
    TmpNum NUMBER;
    TmpStr VARCHAR2(255);
    BEGIN
    --How do set these?
    SET TMPNUM := SELECT Count( * ) FROM ALL_TABLES;
    SET TMPSTR := P2 + '_APPENDED';
    INSERT INTO TEST_TABLE
    ( STRINGFIELD, NUMBERFIELD )
    VALUES
    ( TmpStr, TMPNUM )
    END;
    Regards
    DC

    Some ways are...
    setting directly
    x := 1;
    setting from a select use INTO clause
    select 1 into x from dual
    setting from a select into a collection type use BULK COLLECT INTO
    select name bulk collect into lName from your_table.
    It would be better if you read the document.
    Thanks,
    Karthick.

  • How to pass the values to stored proc using presentation variable in OBIEE

    Need your help regarding in resolving an issue in OBIEE 10.1.3.4.1
    There are 6 reports say ‘A’,’B’,’C’,’D’,’E’,’F’ in the same subject area.
    The reports are being configured with prompts using either the repository/presentation variables.
    One of the reports say ‘A’ has been configured to pass the values using presentation variables from the prompt in Advanced Tab of the report request to the stored procedure defined in the Execute Before Query section of the connection pool.
    After running another report ‘B’ in the same subject area, upon visiting the report ‘A’ view display error is being seen ( Please have a look below screen shot for your reference) .
    Speculate the issue is around presentation variables of report ‘A’ getting initialized even before running the report.
    Appreciate your earliest advise as this is a prod issue.

    Hi Prasad,
    I got your note, you should not use Session variable syntax to call presentation variable.
    you should use like @{AIC_PROJ_PLAT_SEQ_NO}
    One more thing: first test the variable AIC_PROJ_PLAT_SEQ_NO value then try to pass to SP.
    Hope this helps

  • How to pass session variable value with GO URL to override session value

    Hi Gurus,
    We have below requirement.Please help us at the earliest.
    How to pass session variable value with GO URL to override session value. ( It is not working after making changes to authentication xml file session init block creation as explained by oracle (Bug No14372679 : which they claim it is fixed in 1.7 version  Ref No :Bug 14372679 : REQUEST VARIABLE NOT OVERRIDING SESSION VARIABLE RUNNING THRU A GO URL )
    Please provide step by step solution.No vague answers.
    I followed below steps mentioned.
    RPD:
    ****-> Created a session variable called STATUS
    -> Create Session Init block called Init_Status with SQL
        select 'ACTIVE' from dual;
    -> Assigned the session variable STATUS to Init block Init_Status
    authenticationschemas.xml:
    Added
    <RequestVariable source="url" type="informational"
    nameInSource="RE_CODE" biVariableName="NQ_SESSION.STATUS"/>
    Report
    Edit column "Contract Status" and added session variable as
    VALUEOF(NQ_SESSION.STATUS)
    URL:
    http://localhost:9704/analytics/saw.dll?PortalGo&Action=prompt&path=%2Fshared%2FQAV%2FTest_Report_By%20Contract%20Status&RE_CODE='EXPIRED'
    Issue:
    When  I run the URL above with parameter EXPIRED, the report still shows for  ACTIVE only. The URL is not making any difference with report.
    Report is picking the default value from RPD session variable init query.
    could you please let me know if I am missing something.

    Hi,
    Check those links might help you.
    Integrating Oracle OBIEE Content using GO URL
    How to set session variables using url variables | OBIEE Blog
    OBIEE 10G - How to set a request/session variable using the Saw Url (Go/Dashboard) | GerardNico.com (BI, OBIEE, O…
    Thanks,
    Satya

  • How to set a new session variable?

    Hi all,
    Can anybody say how to set a new session variable in istore?

    Hi,
    you can use either
    pageContext.getAttribute(VAR, PageContext.REQUEST_SCOPE);
    or
    <%@page session="true" %>
    session.putValue
    session.getValue
    Hope this will help.
    Thanks
    Gurjeet

  • How to pass a refcursor to a java stored proc

    Hi all,
    Please forgive me as I am new to Java and JDeveloper....
    I want to pass a refcursor to a java stored proc. Does anyone know how to accomplish this?
    Thanks,
    dayneo

    Hi,
    As Avi has indicated, you can map ref cursor to java.sql.ResultSet
    here are Call Specs and a code snippet from chapter 3 in my book.
    procedure rcproc(rc OUT EmpCurTyp)
    as language java
    name 'refcur.refcurproc(java.sql.ResultSet[])';
    function rcfunc return EmpCurTyp
    as language java
    name 'refcur.refcurfunc() returns java.sql.ResultSet';
    * Function returning a REF CURSOR
    public static ResultSet refcurfunc () throws SQLException
    Connection conn = null;
    conn = DriverManager.getConnection("jdbc:oracle:kprb:");
    ((OracleConnection)conn).setCreateStatementAsRefCursor(true);
    Statement stmt = conn.createStatement();
    ((OracleStatement)stmt).setRowPrefetch(1);
    ResultSet rset = stmt.executeQuery("select * from EMP order by empno");
    // fetch one row
    if (rset.next())
    System.out.println("Ename = " + rset.getString(2));
    return rset;
    Kuassi

  • How to pass XMLType as parameters to Java stored procs ?

    How to pass XMLType as parameters to Java stored procs ?
    ORA-00932: inconsistent datatypes: expected an IN argument at position 1 that is an instance of an Oracle type convertible to an instance of a user defined Java class got an Oracle type that could not be converted to a java class
    Java stored proc -->
    CREATE or replace FUNCTION testJavaStoredProcMerge( entity xmltype,event xmltype ) RETURN VARCHAR2 AS LANGUAGE JAVA
    NAME 'XDBMergeOp.merge(org.w3c.dom.Document,org.w3c.dom.Document) return java.lang.String';
    PL/SQL -->
    declare
    theQuote VARCHAR2(50);
    entity xmltype;
    event xmltype;
    begin
    entity := xmltype('<Quote><Fields><Field1>f1</Field1></Fields></Quote>');
    event := xmltype('<Quote><Fields><Field2>f2</Field2></Fields></Quote>');
    theQuote := testJavaStoredProcMerge(entity,event);
    dbms_output.put_line(theQuote);
    end;
    Java class -->
    public class XDBMergeOp {
    public static String merge(Document entity, Document event) throws Exception {
    return ...
    Thanks in advance.

    I think you'll need to use XMLType and then extract the DOM inside java..
    create or replace package SAXLOADER
    as
      procedure LOAD(P_PARAMETERS XMLTYPE, P_DATASOURCE BFILE);
    end;
    create or replace package body SAXLOADER
    as
    procedure LOAD(P_PARAMETERS XMLTYPE, P_DATASOURCE BFILE)
    AS
    LANGUAGE JAVA
    NAME 'com.oracle.st.xmldb.pm.saxLoader.SaxProcessor.saxLoader ( oracle.xdb.XMLType, oracle.sql.BFILE)';
    end;
      public static void saxLoader(XMLType parameterSettings, BFILE dataSource)
      throws Exception {
        Document parameters = parameterSettings.getDocument();
        SaxProcessor app = new SaxProcessor(parameters);
        app.processXMLFile(dataSource);
      Edited by: mdrake on Apr 6, 2009 11:28 AM

  • Unable to pass the values to stored proc using presentation variable in OBI

    Hi All,
    Need your help regarding in resolving an issue in OBIEE 10.1.3.4.1
    There is an OBIEE requirement whereby two prompts need to be defined.
    1.     Textbox prompt
    2.     Drop-down prompt
    The dropdown values should be populated using textbox prompt. So, we have used presentation variable in textbox prompt and passing the same to select query of drop-down.
    Until this step, the report works just fine.
    Now, the value in both textbox and drop-down needs to be passed to stored proc.
    While trying to pass the values by using the presentation variable, the following error comes-up saying
    Session variable has no value definition.
    Note:Although the corresponding session variable has been set to default value,still the error appears.
    Please advise.
    Regards,
    Prasad

    "Session variable has no value definition" I'm assuming typo error and it should be presentation variable.
    Set default value for presentation variable that may work

  • Value of a variable in my stored proc

    I have a cursor in my Stored Proc. which passes data to a variable "sRowcount" to store how many rows returned from the Cursor. In My Access app. I need to call the stored proc and pass the value of the last row returned.
    e.g.sRowcount=1,sRowcount=2,sRowcount=3,sRowcount=4,sRowcount=5,sRowcount=6. In my Access app, I need to call the stored proc. and get value of last row count sRowcount=6 and pass to somewhere else.
    Thanks

    YESSSS . Thanks you very much Kglad it wotk i put all in a function inside the filmstrip function Tload(theUrl){etc ect}and in the root i call it like this filmstrip.Tload(theUrl);   and it works
    code in the root var link1:Array = new Array();
    var LINK:String;
    var url:String;
    var whoOn:Number;
    whoOn=0;
    var x:XML = new XML();
    x.ignoreWhite = true;
    x.onLoad = function(success) {
    var photos:Array = this.firstChild.childNodes;
    for (i=0; i<photos.length; i++) {
    _root.link1.push(photos[i].attributes.link1);
    url=link1[whoOn];
    theUrl=url;
    filmstrip.Tload(theUrl);//<<--HERE
    x.load("category.xml");
    var cbListener:Object = new Object();
    cbListener.change = function(event_obj:Object) {
    trace(select.selectedItem.label);
    if (select.selectedItem.label == "Last updated") {
    whoOn=0;
    } else if (select.selectedItem.label == "Special") {
    whoOn=1;
    url=link1[whoOn];
    theUrl=url;
    filmstrip.Tload(theUrl);//<<-----HERE
    select.addEventListener("change",cbListener);

  • How to pass page session variable to on-demand PL/SQL process

    I am trying to execute a stored procedure that takes two page session variables as input and executes code based on those two variables. I have tried creating a stored procedure on the db-side and calling it using:
    BEGIN
    PROC_UPDT_EMP(&P23_TC_ID, &P23_EMP_ID);
    END;
    but APEX rejects the variables.
    I have also tried putting in the entire procedure in APEX as well, but I get the same problem. I have also tried using the :P23_TC_ID syntax, and still a no-go. What am I doing wrong?

    If PROC_UPDT_EMP is a stored procedure that takes 2 IN parameters, you would do
    proc_updt_emp(:P23_TC_ID,:P23_EMP_ID);in an after-submit page process. That would pass in the values of those 2 items from session state.

  • How to pass a session variable to the bussines layer?

    Hello,
    I am doing a management application, and I need to store the login user that make insertions on any table, and the pages does not has backing beans.
    I had try to do that bindding the value field of a hidden attribute with the session variable, but it only change the value of the one. My second attempt was make an javascript function to do that on the page´s load, but it not looks like a good solution.
    Someone knows a way to sent the session value to the bussines layer? O a way to access from the Bussines layer to the session?
    Thanks
    Tony

    <p>
    Hi,
    </p>
    <p>
    Another solution (that I always use) is storing simultaneously the same data in HttpSession (in view layer) and session hashtable (in businness layer).
    </p>
    <p>
    You can put and get these data in any businness component using following methods:
    </p>
    <p>
    <font face="courier new,courier" size="2" color="#0000ff">
    private void setToJboSession(String key, Object val){</font>
    <font face="courier new,courier" size="2" color="#0000ff"> Hashtable userData = getDBTransaction().getSession().getUserData();
    if (userData == null) {
    userData = new Hashtable();
     userData.put(key, val);
    }</font>
    </p>
    <p>
     and
    </p>
    <p>
    <font face="courier new,courier" size="2" color="#0000ff">
    private Object getFromJboSession(String key){
     return getDBTransaction().getSession().getUserData().get(key);
    }</font>
    </p>
    <p>
    Kuba 
    </p>

  • Trying to pass Hidden/Session variables from 1 JSP to 3rd JSP

    Hellol JSP Gurus !!
    This is a question on how a hidden or a value of a session variable can be passed from 1 JSP to a 3rd JSP, with the 2nd JSP as a Processing page.
    For eg., here's the scenario
    I have a Login page which has the hidden variables. Once the user enters the Login information, the info is validated in a LoginP.jsp (say, its a Processing page for the Login user/passwd info), which does a sendRedirect to a 3rd (Final) JSP which displays the values of the hidden/session variables of the 1st JSP.
    In my case, for some reason, I am not able to see the value for the hidden or the session variables in the 3rd JSP - they are null values.
    I am attaching some Duke dollars to who ever gives me the right solution.
    Thanks a lot in advance

    Use strings to set attributes;You can store any serializable object in the session. I doubt this will actually change anything.
    Anything wrong with the above code ?Not that I can see ... A number of other things can explain why you're getting null values out of the session. For example :
    - You are not using the implicit session obj in the 3rd jsp, but creating a new one and thus overwriting the one created previously
    - the session timeout value is unusually low, and by the time you're getting to the 3rd jsp, the session is invalidated and you're getting nulls. Verify your server config, or call session.getMaxInactiveInterval() to check the value. Check also if the session is new ( session.isNew() )
    Somebody already pointed this out : If the client does not support cookies and URL rewriting is not enabled, no session ID is returned to the server on a request, which the server then perceives as a new session.
    - Another (remote?) possibility : your 3rd jsp belongs to another webapp (i.e you're redirecting to another app context).
    If nothing of the above applies, post the jsp code and we'll try to help.

  • Direct database request and session variable value

    Hi,
    I have a problem by doing the following : idea is to have report with a list of all tables in user schema (which are not all in repository physical layer).
    By clicking on the name of any, should bring answer report which is done as direct database request doing basically select * from table_clicked (this will be basically the same table with sufix _err holding error rows).
    What I'm trying to do is having some kind report for error rows which can be in different tables in my database. So i had in mind to construct name of table i need , and pass it to database request through session variable. Am i doing right by doing direct database request like this :
    select * from 'VALUEOF(NQ_SESSION.TestVar2)'
    Is there another easyer way of doing this? I know this can be done by gourl by passing parameters but not sure how when i can't filter columns in direct database request (this can be different tables with different names of columns). I hope i didn't complicated this too much.
    Thnx in adwance

    Hi,
    I know this is a hack, and would be much more easy to create one table with dimension and measures, but this is intended to be used with code generator, which can produce different error tables with different column names in different time: It is not conviniet for somebody to add them to repository every 5 minutes. For example : i run my workflow and for first run I have errors in table1(let us say customer table with 30 columns) and if click on the table name in some answer report, i want to see all the bad records in the table. Tomorrow after the run, there are bad records in table1 and in table2 (lets say products) so I would have choice to pick table 1 or table2 and see al the bad records in any of these tables. This means that I can not now which tables will I have tomorrow, and as it is generic, I can manually add some tables in my model, and would have to add err table also as a possibility to have error rows?
    I saw post saying that you can pass parameter value by using go url functionality, by modifying configinstance file, but didn't suceed - http://gerardnico.com/wiki/dat/obiee/logical_sql/obiee_session_variable_go_url . Maybe some mistake or any better solution? I created session variable TestVar2, also modified instanceconfig.xml by adding this before </ServerInstance>
    <ParamList>
    <Param name="NQ_SESSION.TestVar2" source="url" nameInSource="SETVAR"/>
    </ParamList>
    and used go url in column formula : ''||"Physical Targets"."Physical Table"||''
    Can I use @1 for using first column value?
    Thnx

  • How to get the session variable value in JSF

    Hi
    This is Subbus, I'm new for JSF framewrok, i was set the session scope for my LoginBean in faces-config.xml file..
    <managed-bean-name>login</managed-bean-name>
    <managed-bean-class>LoginBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope> like that...
    So all parameter in LoginBean are set in session right ?... for example i used userId is the Parameter...
    Now i need to get the the userId parameter from that session in my another JSP page.. how i get that ?..
    Already i tried
    session.getAtrribute("userId");
    session.getValue("userId");
    but it retrieve only "null" value.. could u please help me.. it's very urgent one..
    By
    Subbus

    Where i use that..is it in jsp or backend bean...
    simply i use the following code in one backend bean and try to get the value from there bean in the front of jsp page...
    in LogoutBean inside
    public String getUserID()
         Object sessionAttribute = null;
         FacesContext facescontext=FacesContext.getCurrentInstance();
         ExternalContext externalcontext=facescontext.getExternalContext();
         Map sessionMap=externalcontext.getSessionMap();
         if(sessionMap != null)
         sessionAttribute = sessionMap.get("userId");
         System.out.println("Session value is...."+(String)sessionAttribute);
         return (String)sessionAttribute;
         return "fail";
    JSP Page
    <jsp:useBean id="logs" scope="session" class="logs.LogoutBean" />
    System.out.println("SS value is ...."+logs.getUserID());
    but again it retrieve only null value.. could u please tell me first how to set the session variable in JSF.. i did faces-config only.. is it correct or not..
    By
    Subbus

Maybe you are looking for