Using Global Temporary Table in OBIEE 11

Hi,
THe requirement is to run a database function before the report runs. This Function accepts 5 parameters (Presentation Variable) and populates a GTT Global Temporary Table.
This GTT is configured in presentation Layer.
Issue:
1. Created a dummy report which returns only one row and called the fucntion using "Evaluate" in this.
2. Created 2nd report using GTT Columns.
All these 2 reports placed on dashboard and Presentation variable are set in the prompt. The first one runs correctly and populate the "Regular Table". Means when I create a regular table instead of GTT I can see the correct record. But if I change it to GTT then the data does not get populated in this table.
Any Inputs?
Regards

HI,
If you are using a GTT, you need to run the function which populates the GTT before OBI server executes the select query on that table.
In your case, the OBI server is executing the select query from the table before the data is populated in the table.
In order to force the BI server to run the query after the GTT is populated, you need to specify the condition in the connection pool settings under the connection scripts tab.
In the execute before query, enter your physical query which runs the function to populate the GTT.
Hope this helps !
Thanks,
Vineeth

Similar Messages

  • When to use global temporary tables?

    which are the probable situations when one can think of using global temporary tables?

    In my experience, most often GTTs are used by developers from other RDBMSs who have become used to needing 'intermediate tables' created on the fly to hold data while they 'loop and commit to free locks'.
    These developer may not have had enough exposure to Oracle's concurrency model and therefore use the 'other' concurrency model as the basis for an application port - usually followed up by a call to the forum for assistance in performance tuning. <g>
    That said, legitimate uses for GTTs include staging or scrubbing table for data transport or preparation, eg: ETL into a warehouse, when the intermediate data is
    a) reproducible (therefore does not need to be logged); and
    b) the results of the intermediate operation, but not the source, are stored in permanent tables.
    Some developers also use GTTs to hold the equivalent to a 'temporary materialized view' specifically for complex reporting purposes.

  • Java Error while Using GLobal Temporary Tables

    Hi,
    Am having a global temporary table in my application with ON COMMIT DELETE ROWS option.
    I use it in a procedure to remove previous records, populate new ones and return a ref cursor
    Am calling this procedure from a java bean. In this call, the procedure gets executed successfully but when i try to access the RefCursor Object, I get an SQL Exception that the object no longer exists.
    Here are some inputs for reference:
    My DB Call:
    cstmt = myConn.prepareCall ("{ call MYPACKAGE.GTT_PROCEDURE(?,?,?,?,?, ?,?,?,?,?, ?,?,?,?,?)}");
    My RefCursor Access:
    rsRuleSet = (ResultSet)cstmt.getObject(11);
    The SQLException:
    java.sql.SQLException: ORA-08103: object no longer exists
    Please note that the SQLException shown as per Java Stack trace is on the line with the RefCursor Access
    If anybody has any idea, then do reply
    Thanks in Advance,
    Piyush

    A couple of thoughts...
    Have you tried calling this procedure from PL/SQL to verify that the REF CURSOR returned is valid?
    Is your Java application set to autocommit, or do handle transactions yourself. If the container is handling transactions, it may committing as soon as the stored procedure finishes running, which would clear your temp table.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Problem ! Calling report6 from forms6(run_product()) using global temporary table.

    Requirement :
    To generate stock movement report for certain selected items.
    Background :
    A Form is created with data block (tmp_item_master - a global temporary table)
    when_new_form_instance :
    inserting into tmp_item_master from item_master and then execute_query on tmp_item_master block.
    User selects certain items using check box provided.
    Now tmp_item_master is updated for ch_select_flag_yn = 'Y' for selected items
    and commit.
    Calling report from form(using run_product()).
    Now the main query in report, is joined with tmp_item_master where ch_select_flag_yn = 'Y'
    Here, we are unable to see the report for any item. As the global temporary table data is not visible in the report session.
    How to resolve this problem ?
    Note : global temporary table created with ON COMMIT PRESERVE ROWS
    Thanking you,
    From praful.
    null

    Hi,
    You are using 'ON Commit Delete Rows' . Instead of Use ' ON COMMIT PRESERVE ROWS'
    The ON COMMIT DELETE ROWS clause indicates that the data should be deleted at the end of the transaction.
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
    column1 NUMBER,
    column2 NUMBER
    ) ON COMMIT DELETE ROWS;
    In contrast, the ON COMMIT PRESERVE ROWS clause indicates that rows should be preserved until the end of the session.
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
    column1 NUMBER,
    column2 NUMBER
    ) ON COMMIT PRESERVE ROWS;
    Edited by: Mrucha on Nov 26, 2012 6:06 AM

  • Using Global Temporary Table in Discoverer.

    Hi All
    I am currently working on a Disco report, where I am initializing a package at the disco condition level which inserts data in to a Global Temporary Table.
    The global temporary table will be having data based on the parameter entered by the user. But the problem occurs when we are trying to use the same GTT in the select statement as shown below. The desktop is not giving me the otuput but the GTT is getting populated with data.
    see below
    SELECT bla1,
    bla2,
    bla3
    FROM GTT (global temp table)
    WHERE 1= PACKAGE.FUNCTION(par1, par2, par3...) <- here we are trying to insert into GTT based on the paramenters passed.
    Can you please suggest how this can be achieved. Or is there any way to trigger the insertion in to GTT other than the calling it in the condition level.
    Thanks
    Arun

    Hi,
    You cannot use a GTT like this because you cannot write and read from the GTT using a single SQL statement. You must either have the insert in a separate worksheet and tell the users to run this worksheet first, or you wrap it all up in a table function called from within a view. The table function can then insert and select from the GTT using two statements.
    Which method is best depends on what you are trying to do and why you want to use a GTT.
    Rod West

  • Use of global temporary tables in Procedures

    Hi
    I am using global temporary tables in the procedures. Loading data in the same table through many procedures. I am fetching the data from the global temporary table in PRO-C by a cursor. Will this degrade performance?
    Please help me..
    Thanks in Advance...

    Will this degrade performance?That depends... in comparison to what?
    Loading data into temporary tables will generally be more efficient than loading data into permanent tables because Oracle needs to do less to protect this data since it is inherently transient. On the other hand, loading the data into a table in the first place tends to be more expensive than alternatives like using a single SQL statement, a pipelined table function, or an in memory collection.
    Justin

  • Will Partitioning improve performance on Global Temporary Table

    Dear Guru,
    In one of complicated module I am using Global Temporary Table (GTT) for intermediate processing i.e. It will store required data in it but the rows of the data goes into 10,00,000 - 20,00,000.
    Can Partitioning or Indexing on Global Temporary Table improve the performance?
    Thanking in Advance
    Sanjeev

    Sounds like an odd use of a GTT to me, but I'm sure there are valid reasons...
    Presumably you are going to be processing all of these rows in some way? In which case I can't see how partitioning, even if it's possible (And I don't think it is) would help you.
    Indexes - sure, that might help, but again, if you are reading all/most of these rows anyway they might not help or even get used.
    Can you give a bit more detail about exactly what you are doing?
    Edited by: Carlovski on Nov 24, 2010 12:51 PM

  • Best to use in terms of tuning Global Temporary table or PLSQL Table type

    Hi All,
    which one is best to use in terms of tuning Global Temporary table or PLSQL table type?
    Thanks in Advance.
    Regards
    Deepika

    user8828028 wrote:
    which one is best to use in terms of tuning Global Temporary table or PLSQL table type?The answer to which one is better depends on the requirements - and an informed decision as to which one to use to address those requirements.
    Thus it is important to understand how these work. They are nothing alike.
    PL/SQL collections reside in the PGA. Can only be used in SQL via binding. Cannot be indexed. Temp tables on the other hand does not use expensive PGA. Does not need to be bind in SQL. Can be indexed. Etc.
    Sure, a (surgical) saw and scalpel are both used on the operating table - but for very different purposes.

  • What is the syntax for creating global temporary table using a select query

    hii
    I'm creating a global temporary table using a select query ..how to mention 'on commit preserve rows' that?
    create global temporary table t1 as select * from trn_ordbase on commit preserve rows;
    but this is invalid syntax,so how to mention on commit preserve rows in this???if i dont mention it ,by default its considering as on commit delete rows.
    Please help me out of this problem.

    create global temporary table t1 as select * from trn_ordbase on commit preserve rows;You CANNOT use this syntax.
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/sqcmd.htm
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/glob_tab.gif
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/cre_tabl.gif

  • Can I use Parallel execution for Global Temporary table within SP and How

    Dear Gurus,
    I have Global temporary table as below
    Create global temporary table Temp_Emp
    empno number,
    ename varchar2(20),
    deptno number
    ) on commit preserve rows;
    During processing I insert the data into this table and then fire query on Temp_Emp, get the data and pass it to front end.
    The SP as shown below
    Create or replace procedure get_emp_data
    empid in number,
    emp_detail out RefCsr -- Ref cursor
    as
    begin
    -- some code here
    open emp_detail for
    select *
    from Temp_Emp
    where empno = empid;
    end get_emp_data;
    Can use Parallel Query execution on Temp_Emp table and how ?
    i.e. do need to explicitly use parallel construct in query or is it default.
    Because I have many SQL like above (on global temporary tables) within Stored Procedures.
    Can anybody give me any suggestion.
    Thanking in Advance
    Sanjeev

    How come you are populating a temporary table and then opening a cursor on this temporary table for the front end to use?
    Couldn't you presumably just form a query out of the code you use to populate the temporary table? This is the recommended approach in Oracle.

  • Life time of data in a Global Temporary Table.

    Dear Friends,
    I have a global temporary table in which I insert some values via a backend package, when forms start up and accessing it via the same package when user performs some changes in it - storing the value and during exit saving it in the master table. My problem is the data is not accessible while processing. I'm using Oracle9i Enterprise Edition Release 9.2.0.1.0 database and Forms [32 Bit] Version 6.0.8.8.0. I also give you the script in using which I created the temporary table.
    CREATE GLOBAL TEMPORARY TABLE GTT_PRA
    A1 VARCHAR2(10 BYTE) NOT NULL,
    A2 VARCHAR2(15 BYTE) NOT NULL,
    A3 VARCHAR2(10 BYTE) NOT NULL
    ON COMMIT DELETE ROWS;
    Why is that so? Please help me.
    With Regards,
    Senthil .A. Perumal.

    Dear Arun,
    Thank you for your script. But I'm accessing a large table, so for each and every process, the table get populated and grows very large giving some space problem, that is why I'm deleting rows when commiting. I would appreciate your help.
    Dear Yogesh,
    From the same forms I'm calling the backend package - will that be a different session. Once I'm calling to populate the table and next time I'm calling to store the user modified data and finally calling to store the data to master table. I think all are in the same sessions. Please reply me.
    Thank you dear friends fr your immediate response. I would really appreciate it.
    Regards,
    Senthil .A. Perumal.

  • ORA-00955 reports when I try to "create global temporary table" in windows

    Hi,
    When I try to run the sql in my oracle 9i server which is installed in a windows2000 machine,
    Create global temporary table test ...;
    For the first time, I can create table successfully.
    But I cannot access this table any more:
    drop table test;
    desc test;
    select * from test;
    In addition, if I try to create the table again, I got the error:
    ORA-00955: name is already used by an existing object
    While the same table can be created and dropped in another oracle9i server which is installed in Solaris 9 machine.
    So I suspect that this sould be a bug of window oracle server.
    Is there anyone who can confirm this?
    Or who can tell me how to report this bug to oracle?
    Thanks in advance.
    Please also refer the message at:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1046974576560
    If you search the text: "create global temporary table sess_event", you can see for the first time, the table is created successfully.
    But the ORA-00955 reports when the author try to create table for the second time.
    This problem is exactly the same as my problem.
    I have also made a search both in Google and in Oracle website and I cannot find any solution of it.

    Read      Metalink Note:68098.1 Subject:      Overview of Temporary Tables
    How did you difine the temporary tables? on commit delete rows are reserv rows?
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg03sch.htm#7794
    Jaffar
    Message was edited by:
    The Human Fly

  • Creating a Global Temporary Table on non-default TEMP tablespace.

    Hello ,
    I am using Oracle 11g.
    I have a procedure which create global temporary tables for its functionality. As the data which is going in the global temporary table , mean the data which is going in the default TEMP tablesapce is too huge ..... billions of rows..
    So what i want to do is , I want to create the global temporary table in another TEMP2 tablespace ( which is not the default one) so the load of billions of rows of data will be shifted to TEMP2. The default TEMP tablespace will not be affected and it can be used for other transactions.
    Is this possible. Can i shift the global temporary table from TEMP( Default temp tablespace) to TEMP2 ( the non-default temp tablespace) ????
    Please guide me with proper solutions and examples ....
    Thanks in advance ..

    DBA4 wrote:
    Hello ,
    I am using Oracle 11g.
    I have a procedure which create global temporary tables for its functionality. As the data which is going in the global temporary table , mean the data which is going in the default TEMP tablesapce is too huge ..... billions of rows..
    So what i want to do is , I want to create the global temporary table in another TEMP2 tablespace ( which is not the default one) so the load of billions of rows of data will be shifted to TEMP2. The default TEMP tablespace will not be affected and it can be used for other transactions.
    Is this possible. Can i shift the global temporary table from TEMP( Default temp tablespace) to TEMP2 ( the non-default temp tablespace) ????
    Global temporary tables are instantiated in the temporary tablespace of the schema that inserts the data - not into "the default" temporary tablespace.
    Assume Schema1 creates a GTT and grants all on that table to schema2
    Assume schema1 also creates a procedure (authid owner, the default) to insert data into the GTT and grants execute on the procedure to schema2
    If schema2 executes: insert into schema1.gtt, the data will appear in the temporary tablespace of schema2
    If schema2 executes: execute schema1.procedure, the data will appear in the temporary tablespace of schema1
    So if you want to protect the "normal" temporary tablespace, you could just create a special temporary tablespace for the owner of the procedure.
    Regards
    Jonathan Lewis

  • Doubt with Global Temporary table

    hi,
    i have created a global temporary table with ON COMMIT DELETE ROWS option. in my Function in a loop i m inserting values into this Table, after that loop closes and then i m selecting some other values from DB. and in the last i am returning a ref cursor which is selecting values from temporary table i hav created.
    now the thing is i m not getting any values in the cursor.
    later I have created the table with ON COMMIT PRESERVE ROWS option, in this case cursor returning values,
    can anyone explain me the functionality, as per my knowledge global temporary table values are session specific so why i m not getting the values in the 1st case when i used ON COMMIT DELETE ROWS (same session).
    Thanks
    Piyush

    Ok, here's a simple example, like we'd like to see from you not working....
    First create a GTT with ON COMMIT DELETE ROWS...
    SQL> ed
    Wrote file afiedt.buf
      1* create global temporary table mytable (x number) on commit delete rows
    SQL> /
    Table created.Now a simple function that populates the GTT and returns a ref cursor to the data without doing any commits (hence the data should be there!)
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function pop_table return sys_refcursor is
      2    v_rc sys_refcursor;
      3  begin
      4    insert into mytable
      5    select rownum from dual connect by rownum <= 10;
      6    OPEN v_rc FOR SELECT x FROM mytable;
      7    RETURN v_rc;
      8* end;
    SQL> /
    Function created.So now we call the function and get a reference to our ref cursor...
    SQL> var v_a refcursor;
    SQL> exec :v_a := pop_table();
    PL/SQL procedure successfully completed.So, in principle, because no commits have been issued the ref cursor should return data...
    SQL> print v_a;
             X
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    10 rows selected.... which it does.
    Now, what happens if we do that again...
    SQL> commit;
    Commit complete.
    SQL> exec :v_a := pop_table();
    PL/SQL procedure successfully completed.... but this time we commit before retrieving the data...
    SQL> commit;
    Commit complete.
    SQL> print v_a;
    ERROR:
    ORA-00600: internal error code, arguments: [kcbz_check_objd_typ_1], [0], [0], [1], [], [], [], []
    no rows selected
    SQL>Oracle has (correctly) lost reference to the data because of the commit.
    So show us what yours is doing.

  • Does Global Temporary Table help in performance?

    I have a large database table that is growing daily. The application I have has a page for the past day data and another for some chosen period of time. Since I'm looking at a very large amount of data for each page (~100k rows) and having charts based on time, I have performance issues. I tried collections for each of these and found out that it is making everything slower and I think because the collection is large and it is not indexed.
    Since I don't need the data to be maintained for the session and in fact for each time that I submit a page I need to get the updated data at least for the past day page, I wonder if Global Temporary Table is a good solution for me.
    The only reason I want to store the data in a table is to avoid running similar queries for different charts and reports. Is this a valid reason at all?
    If this is a good solution, can someone give me a hint on how to do this?
    Any help is appreciated.

    It all depends on how efficient your query is. You can have a billion row table and still get a fraction of a second response if the data is indexed, and the number of data blocks to be visited to retrieve the data is small. It's all about reducing the number of I/Os to find and retrieve your data with the query. Many aspects of the data, stats, table/index structure etc can influence the efficiency of your query. The SQL forum would be a better place to get into the query tuning, but if this test is fast, you can probably focus elsewhere for now. It will resolve your full resultset, and then just do a count of the result (to avoid sending 100k rows back to the client). We are trying to get an idea of how long it takes to resolve your resultset. Using litterals rather than item names in your sql should be fine for this test. Avoid using V() around item names in your SQL.
    select count(*) from ( <your-query-goes-here> );

Maybe you are looking for