Global Temporary table in Forms

I have two forms A and B, I call form B from form A using [FND_FUNCTION.EXECUTE] with [SESSION_FLAG] parameter = 'NO_SESSION' nd [PEN_FLAG] parameter = 'Y, I insert records in database procedure called in form B and display the records in form B and the records are displayed perfectly but when i return to form A using [APP_CUSTOM.CLOSE_WINDOW] I wasn't able to access the records.
I have created the global temporary table with option [ON COMMIT PRESERVE ROWS] but i can't perform a [COMMIT] command because i have transactions in form A that i don't want to save.
I should access the records in the global temporary table since i am still in the same session but i can't.

http://psoug.org/reference/gtt.html
Francois

Similar Messages

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

  • Global temporary table

    Hi
    how to create global temporary table and push data from forms.
    Thanks
    Shital

    hi
    try something like this.
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
      column1  NUMBER,
      column2  NUMBER
    ) ON COMMIT DELETE ROWS;If its Correct/Helpful please Mark it thanks.
    Sarah

  • Why can't global temporary tables have foreign keys?

    Hi,
    I have a forms module which shows two blocks. The first block is based on a normal database table EMP and the second one is based on a global temporary table SAL_TEMP. There is a master-detail relation between the two blocks. So far, in Designer I created two normal database tables EMP and SAL_TEMP and created a foreign key with validation level "none" from the table SAL_TEMP to the table EMP. By creating the foreign key, Designer generates code to automatically synchronize the data between the master and the detail block in my form.
    In the latest version of Designer it is finally possible to indicate a table as a global temporary table. But when I try to change my table SAL_TEMP to a global temporary table (session) I get an error that this is not allowed because my table contains foreign keys. So the Designer team finally implemented this feature but it is useless to me.
    Can someone explain to me the reason of this restriction?
    Vincent

    Just out of curiosity - which version of Designer supports the creation of global temp tables? We are running version 9.0.2.80.6 and, as far as I am award, this does not support it (unless I am being really thick!) - is this new 10g Dev. Suite functionality?
    thanks,
    Pete

  • Datas deletion from Global Temporary table  when clear command is given

    Dear All,
    How to Delete datas from global temporary Table when clear command is given in forms
    Suggest me syntax..
    Pls help..
    Regards,
    Gokul.B

    http://psoug.org/reference/gtt.html
    Francois

  • 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

  • Global temporary table report with different session

    Dear All,
    I want to pass collection of records from a Form to a report, I think of global temporary table, but according to our application setting, openning a report through OM, opens new session, hence data will not be saved in that global temporary table.
    thanks for any idea.

    Please see my post here.
    Re: Want to Create View as per Condition Fires After Parameter Form.
    In forms, insert records into this temp table and pass the records' id, which was inserted by you with each record, to the report (one collection of records will have only one id).
    Hope this helps.

  • Need Advise on Global Temporary tables or Materialized views or Views

    Need advise on a plsql procedure working on.
    I had 6 tables having 200,000 rows in total intially,but will get added a maximum 20,000 rows daily by a batch process.
    I am writing a plsql code that takes an input ,for example customer_id, and is required to get all the data for that customer_id and
    had to do some complex calculation that includes stepwise validations before giving the output.Now while doing the logic it has the get the data for that customer_id from all the tables.
    There may be 100 records for that particular customer_id.
    I need advise on the below options.
    1.Use of global temporary tables get those 100 records and do the calculation part on that Global Temporary table.
    2.Use of Views or Materialized views.
    3.Using the Record Structures(like table types for those records) and then do the logic on them
    As Performance is the key point here i would like pull all the data at once into memory and then do the calculations instead of hitting the database many times, this is my main idea(correct me if am wrong).Also please advise if there are any other options
    I am using ORACLE 10G.
    Thanks
    Rede

    The approach that many advocate for here (including myself) is to do as much in SQL as possible. So, copying to GTTs or using record structures is probably not the solution you should be after.
    If you can provide the following details we may be able to steer you down the right path
    1. Oracle version (SELECT * FROM V$VERSION)
    2. Sample data in the form of CREATE / INSERT statements.
    3. Expected output
    4. Explanation of expected output (A.K.A. "business logic")
    5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
    Ideally try and re-create the problem, simplifying it as much as possible, without losing context. Use #1-#5 above as a base for posting your simplified problem here. Then we may be able to give you a solution specific to your problem.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

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

  • Auditing data from global temporary table

    Hi I have a process that uses a global temporary table.
    What it does it serve a consolidation point to merge a lot of data.
    Some the former designer decides to use a global temporary table and the row will be gone once it got commit.
    However, the data is corrupted occasionally. And ideally we would like to fix the upstream source data but this is too complicated and not feasible.
    So we decide to audit the data going into the global temporary table. We want to generate a report on the corrupted data.
    However, whenever I commit, the data is gone from the global temporary table and we do not want to set it to commit preserve rows for the global temporary table
    Even with autonomous transaction this is not working out as once it commits the data is gone.
    Any idea how this can be done. Here are the prototype that I build to demo this:
    drop table gt_tst1;
    --this is the table its data needs to get audit
    create global temporary table gt_tst1(id number); --on commit preserve rows;
    drop table not_gt_tst1;
    --this table is used for storign the corrupt data and generate report
    create table not_gt_tst1 as select * from gt_tst1;
    CREATE OR REPLACE PROCEDURE tst_gt_tst1 IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    --if there is a way to do the insert and select once. but it seems it is not working for global temporay table unless change it to on commit preserve rows
      INSERT
      when m2 = 0 THEN
      INTO not_gt_tst1(id)values(object_id)
      when m3 = 0 THEN
      INTO gt_tst1(id) values (object_id)
      select object_id,mod(object_id,2) m2, mod(object_id,3) m3 from dba_objects where rownum < 101;
      COMMIT;
    END tst_gt_tst1;
    select sysdate from dual;
    truncate table gt_tst1;
    truncate table not_gt_tst1;
    select * from gt_tst1;
    select * from not_gt_tst1;
    execute tst_gt_tst1;
    select * from gt_tst1; -- data gone
    select * from not_gt_tst1;
    --commit
    select sysdate from dual;
    spool off

    The data is poor and the code is poor and the dev and QA env is also poor..
    And the business asks us to fix the data..However..we do not have an environment close enough to test it out before it got put into production that is the bottom line.
    Heres the dev and QA env cannot be trust to the extent that I can sign off and say it will give the same behavior as the production env
    So we would like to minimize the risk as there are other process uses these table and we are not sure if changing this would lead to UN-expected behavior.
    We cannot tell some other process rely on the fact that these table got empty out after commit.
    Edited by: vxwo0owxv on Jan 23, 2012 12:18 PM
    Edited by: vxwo0owxv on Jan 23, 2012 12:20 PM

  • 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

  • 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

  • How can i create a Global Temporary Table inside a Stored Procedure....

    Hi...
    I need to create a Global Temporary Table inside a Stored
    Procedure....
    I have no idea how to do that....
    Please....if u can send me a sample, send to me....
    Thanks a lot

    To create a global temporary table inside a stored procedure,
    the minimal syntax would be:
    CREATE OR REPLACE PROCEDURE procedure_name
    AS
    BEGIN
    EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE table_name'
    || '(column_name NUMBER)';
    END procedure_name;
    As Todd stated, it would probably be better to create the global
    temporary table outside of the procedure:
    SQL> CREATE GLOBAL TEMPORARY TABLE table_name
    2 (column_name NUMBER);
    Table created.
    You can also specify things like ON COMMIT PRESERVE ROWS or ON
    COMMIT DELETE ROWS.
    It may be that there is something else, like a PL/SQL table of
    records or a cursor, that would suit your needs better. It is
    difficult to guess without knowing what you want to do with it.

  • 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

  • Transaction with Global Temporary Table

    Problem:
    Transaction starts with few DML statements and in the middle we are calling a JAVA method which creates the dynamic global temporary table and proceeding with few DML statements, if one of the statement fails, in the exception clause we are trying to rollback and transactions after the DDL (create global temp table) are rolled back and transactions before the DDL (create global temp table) are committed.
    We cannot pre-create the global temporary table, since we do not know the number of temp table to be pre-created.
    How we can resolve this issue? The same concept works for SQL server.
    Example of our issue:
    --drop table table1 purge;
    --drop table t_id purge;
    Create table table1 (col1 number, col2 varchar2(20));
    Insert into table1 values (1, 'Test1');
    Create global temporary table t_id (id number);
    Insert into table1 values (2, 'Test2');
    Rollback;
    After the rollback you can see only the 'Test1' record.

    > We cannot pre-create the global temporary table, since we do not know the number of temp table to be pre-created.
    I don't see how one procedure could need to create an unknown number of temporary tables. Do they all have different (and unknown) column lists? Couldn't you combine them into a single table with a key to distinguish betweeen the different sets of rows?

Maybe you are looking for