Are global temporary tables in Oracle 10.2 behaving differently?

My procedure is creating and inserting data into a Global Temporary Table (on commit data is preserved). I am running this procedure in two different environments.
The first environment is running under Oracle 10.2 and after the procedure runs successfully I can not see any data inserted in the GTT.
When I run the very same procedure in the second environment which runs under Oracle 9.2, it works fine, runs successfully and I can see all rows inserted in the GTT.
Can someone explain this? What should I do differently in the Oracle 10.2? Any thoughts?
Thank you very much.

Hi,
The following TEMPORARY table is created with the attribute, ON COMMIT DELETE ROWS. This allows an application to load registration entries into the global temporary table and manipulate that data with SQL statements. The data is deleted upon each commit with the clause ON COMMIT DELETE ROWS.
CREATE GLOBAL TEMPORARY TABLE student_reg_entries
student_name VARCHAR2(30),
reg_entries reg_entry_varray_type
) ON COMMIT DELETE ROWS;
Replace ON COMMIT DELETE ROWS with ON COMMIT PRESERVE ROWS to retain temporary table data throughout the database session, regardless of any commits made during that session.
The following illustrates a PL/SQL block that populates this temporary table with two classes each for two students. It makes no difference how many other applications are currently using this temporary global table for similar purposes. For the code below, two rows are inserted, then a COMMIT, after which a SELECT shows that the table is empty.
DECLARE
classes_to_take reg_entry_varray_type :=
reg_entry_varray_type();
BEGIN
classes_to_take := reg_entry_varray_type(
reg_entry('CS101', 'C' ),
reg_entry('HST310', 'C' ));
INSERT INTO student_reg_entries VALUES
('John', classes_to_take);
classes_to_take := reg_entry_varray_type(
reg_entry('ENG102', 'C' ),
reg_entry('BIO201', 'C' ));
INSERT INTO student_reg_entries VALUES
('Mary', classes_to_take);
END;
This next SELECT returns two rows:
SQL> SELECT * FROM student_reg_entries;
Row 1:
John
REG_ENTRY_VARRAY_TYPE
(REG_ENTRY('CS101','C'), REG_ENTRY('HST310','C'))
Row 2:
Mary
REG_ENTRY_VARRAY_TYPE
(REG_ENTRY('ENG102','C'), REG_ENTRY('BIO201','C'))
A COMMIT automatically deletes rows making the table available for the next session transaction.
SQL> COMMIT;
SQL> SELECT * from student_reg_entries;
no rows selected
The full information about this article is in the link I post before, I'm just showing this extract of the article because some people don't like to read links....
Cheers,
Francisco Munoz Alvarez
http://www.oraclenz.com

Similar Messages

  • Problem with global temporary table in Oracle 10g

    Hi All,
    I face a peculiar problem in Oracle 10g with respect to Global temporary table.
    Have Oracle 10g version in Production and 11g version in UAT.
    Table_
    create global temporary table TT_TEMPGPSMANUAL
      Col_1    VARCHAR2(50),
      Col_2    VARCHAR2(500),
      Col_3    VARCHAR2(50),
      Col_4    VARCHAR2(50),
      Col_5    VARCHAR2(15),
      Col_6    VARCHAR2(20),
      Col_7    VARCHAR2(250),
      Col_8    VARCHAR2(20),
      Col_9    VARCHAR2(15),
      Col_10   VARCHAR2(20),
      Flag     NUMBER,
      Col_11   INTEGER,
      Col_12   VARCHAR2(50)
    on commit preserve rows;So this should preserve the rows inserted into this table until the session ends.
    Have a webpage in front-end where in turn, it opens another page (session is carried through) and a few rows will be inserted to this table from the webpage (through a function) on submit and the current page will be closed.
    From the parent page, if I open the sub-page data inserted in the temporary table are held and displayed (another function to fetch the values in the Global Temp table).
    The Problem in Oracle 10g (Production) is, this is not happening properly. When I close and open the sub-page, not every time I get the data stored i.e if I close and open the page 10 times, atelast 4 times the data is missed in the page (I am not getting values from temp table) randomly.
    But this does not happen in UAT (which has Oracle 11g installed) as I get the data in the webpage consistently. After passing UAT, when we rolled out to Prod, getting this issue which we are unable to get what could be the reason.
    It is very hard to debug using GTT dynamically in prod. It takes time to get Oracle 11g installed in Prod.
    Can anyone suggest?
    Regards
    Deep

    935195 wrote:
    Also, I am opening the sub-page from the parent page (through a hyperlink). Then in this case, Would session will be changed from parent to subpage? (I am not aware exactly and have the impression that, as the second page is a child, I guess it would take the same session).I'm not sure what "sub-page" or "parent page" means to you. If you're just linking from one page to another, "parent" and "child" don't really make sense since page A links to page B and B links to A quite frequently.
    Assuming that you have to log in to access the site, it is likely that the two pages share the same middle tier application session. It is unlikely that the middle tier would hold the database session from the first request open waiting to see if the user eventually requested the second page. It is theoretically possible that you could code your middle tier this way but it is extremely unlikely that you would want to do so for a variety of reasons. So, when you say "would [the] session ... be changed", it is likely that the application session would be the same for both calls but that the database session would be different.
    Justin

  • Performance issue with Oracle Global Temporary table

    Hi
    Oracle version : 10.2.0.3.0 - Production
    We have an application in Java / Oracle. Users request comes in XML and oracle parser parses it and inserts it into Global temporary tables and then Business Stored procedure picks data from these GTT's and do the required processing.
    in the end data required response data is again inserted into response GTT's from which Response XML is generated.
    Question : Is the use of Global temporary tables in Oracle degrades performance as we have large number of GTT's in our application approx. 5-600 such tables.
    Regards,
    Vikas Kumar

    Hi All,
    Here is architecture of my application:
    Java application creates XML from the screen values and then inserts that XML
    into a framework(separate DB schema) table . then Java calls a Stored Procedure from same framework DB and in SP we have following steps.
    1. It fatches XML from the XML type table and inserts XML into screen specific XML TYPE table in the framework DB Schema. This table has a trigger which parses XML and then inserts XML values into GTT which are created in separate product schemas.
    2. it calls Product SP and then in product SP we have business logic. Product SP
    does the execution and then inserts response into Response GTT.
    3. Response XML is created by using XML generation function and response GTT.
    I hope u will understand my architeture this time and now let me know if GTT are good in this scenario or not. also please not that i need data in GTT only during execution and not after that. i dont want to do specific delete which i have to do if i am using normal tables.
    Regards,
    Vikas Kumar

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

  • Global Temporary table is Not working For Pdf Reports

    Hi all
    we are using oracle db-10g, developer suite-10g.
    While generating the Report for the satisfying several conditions we are fetching the data into
    Global temporary table
    On commit preserve rows
    from this temp tables excel is generated properly. but pdf is not generating can anybody exaplain why it is not generating and what to do for that
    Thank you

    query and view are not possible
    here i am giving one of the requirement
    my project is belongs to inventory project.
    report should be generated on the different selection criteria like
    1)user can select one or more product codes
    2)for that product code one or more item codes can select
    like this so many different selection are there more than 12 selections from different tables
    For this each different selection product code into gtt_prod_cd and item_cd into gtt_item_cd. after that performed the query and in where clause we are comparing the values with gtt.
    can you please suggest me what to do for PDF Reports

  • Scalability issue with global temporary table.

    Hi All,
    Does create global temporary table would lock data disctionary like create table? if yes would not it be a scalable issue with multi user environment?
    Thanks and Regards,
    Rudra

    Billy  Verreynne  wrote:
    acadet wrote:
    am I correct in interpreting your response that we should be using GTT's in favour of bulk operations and collections and in memory operations? No. I said collections cannot scale. This means due to the fact that collections reside in expensive PGA memory, you cannot stuff large data volumes into them. Thus they do not make an ideal storage bin for temporary data (e.g. data loaded from file or a web service). GTTs otoh do not suffer from the same restrictions, can be indexed and offer vastly better scalability and so on.
    Multiple passes are often needed using such a data structure. Or filtering to find specific data. As a GTT is a SQL native, it offers a lot more flexibility and performance in this regard.
    And this makes sense - as where do we put out persistent data? Also in tables, but ones of a persistent and not temporary kind like a GTT.
    Collections are pretty useful - but limited in size and capability.
    Rudra states:
    I want to pull out few metrices from differnt tables and processing itIf this can't be achieved in a SQL statement, unless Rudra is a master of understatement then I would see GTT's as a waste of IO and programming effort. I agree.
    My comments however were about choices for a temporary data storage bin in PL/SQL.I agree with your general comments regarding temporary storage bins in Oracle, but to say that collections don't scale is putting to narrow a definition on scaling. True, collections can be resource intensive in terms of memory and CPU requirements, but their persistence will generally be much shorter than other types of temporary storage. Given the right characteristics, collections will scale and given the wrong characteristics GTT's wont scale.
    As you say it is all about choice. Getting back to the theme of this thread though, the original poster should be made aware that well designed and well coded applications are most likely to scale. Creating tables on the fly is generally considered bad practice and letting the database do what it does best, join tables in queries at the SQL level is considered good practice. The rest lies somewhere in between and knowing when to do which is why we get paid the big bucks (not). ;-)
    Regards
    Andre

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

  • Insert slow into Global Temporary Table...

    I am working with a stored procedure that does a select into a global temporary table and it is really slow. I have read up on the append hint and know that it is not a solution since GTT's are in the temporary table space which are thus always appended and never have logs.
    Is there something else that I need to know about performance for GTT? I find it hard to believe that Oracle would find it acceptable to take 50 seconds to insert 3300 rows.

    My apologies in advance as my skill level with Oracle is not as high as I would like for this type of analysis and remediation.
    I had thought of it being the select as well but if I run it by itself it takes about 1 second. The interesting part is when I explain plan on it with the Insert, the SQL plan changes.
    Here is the Non-insert explain plan:
    <code class="jive-code jive-java">
    Plan hash value: 3474166068
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 51 | 8 (38)| 00:00:01 |
    | 1 | HASH GROUP BY | | 1 | 51 | 8 (38)| 00:00:01 |
    | 2 | VIEW | VM_NWVW_1 | 1 | 51 | 7 (29)| 00:00:01 |
    | 3 | HASH UNIQUE | | 1 | 115 | 7 (29)| 00:00:01 |
    | 4 | NESTED LOOPS | | | | | |
    | 5 | NESTED LOOPS | | 1 | 115 | 6 (17)| 00:00:01 |
    | 6 | NESTED LOOPS | | 1 | 82 | 5 (20)| 00:00:01 |
    | 7 | SORT UNIQUE | | 1 | 23 | 2 (0)| 00:00:01 |
    | 8 | TABLE ACCESS BY INDEX ROWID| PEAKSPEAKDAYSEG$METERMASTER | 1 | 23 | 2 (0)| 00:00:01 |
    |* 9 | INDEX RANGE SCAN | IDX_PDSEG$MTR_SEGID | 1 | | 1 (0)| 00:00:01 |
    |* 10 | TABLE ACCESS BY INDEX ROWID | FC_FFMTR_DAILY | 1 | 59 | 2 (0)| 00:00:01 |
    |* 11 | INDEX RANGE SCAN | FC_FFMTRDLY_IDX10 | 2461 | | 2 (0)| 00:00:01 |
    |* 12 | INDEX UNIQUE SCAN | FC_METER_PK | 1 | | 0 (0)| 00:00:01 |
    | 13 | TABLE ACCESS BY INDEX ROWID | FC_METER | 1 | 33 | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    9 - access("SM"."SEGID"=584)
    10 - filter(TO_DATE(TO_CHAR("V"."MEASUREMENT_DAY"),'YYYYMMDD')>=TO_DATE(' 2002-01-01 00:00:00',
    'syyyy-mm-dd hh24:mi:ss') AND TO_DATE(TO_CHAR("V"."MEASUREMENT_DAY"),'YYYYMMDD')<TO_DATE(' 2003-01-01
    00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND ("V"."ADJUSTED_TOTAL_VOLUME"<>0.0 OR
    ROUND("V"."ADJUSTED_TOTAL_ENERGY",3)<>0.0))
    11 - access("V"."METER_NUMBER"="SM"."METER_ID")
    12 - access("M"."METER_NUMBER"="V"."METER_NUMBER")
    </code>
    Here is the Insert explain plan:
    <code class="jive-code jive-java">
    Plan hash value: 4282493455
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | INSERT STATEMENT | | 39 | 2886 | | 7810 (1)| 00:01:34 |
    | 1 | LOAD TABLE CONVENTIONAL | PEAKDAY_TEMP_CONSECUTIVEVALUES | | | | | |
    | 2 | HASH GROUP BY | | 39 | 2886 | | 7810 (1)| 00:01:34 |
    |* 3 | HASH JOIN RIGHT SEMI | | 39 | 2886 | | 7809 (1)| 00:01:34 |
    | 4 | VIEW | VW_NSO_1 | 1 | 10 | | 2 (0)| 00:00:01 |
    | 5 | NESTED LOOPS | | 1 | 27 | | 2 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | PK_PEAKSPEAKDAYSEG | 1 | 4 | | 0 (0)| 00:00:01 |
    | 7 | TABLE ACCESS BY INDEX ROWID | PEAKSPEAKDAYSEG$METERMASTER | 1 | 23 | | 2 (0)| 00:00:01 |
    |* 8 | INDEX RANGE SCAN | IDX_PDSEG$MTR_SEGID | 1 | | | 1 (0)| 00:00:01 |
    | 9 | VIEW | PEAKS_RP_PEAKDAYMETER | 3894 | 243K| | 7807 (1)| 00:01:34 |
    | 10 | SORT UNIQUE | | 3894 | 349K| 448K| 7807 (1)| 00:01:34 |
    | 11 | NESTED LOOPS | | | | | | |
    | 12 | NESTED LOOPS | | 3894 | 349K| | 7722 (1)| 00:01:33 |
    | 13 | TABLE ACCESS FULL | FC_METER | 637 | 21021 | | 18 (0)| 00:00:01 |
    |* 14 | INDEX RANGE SCAN | FC_FFMTRDLY_IDX11 | 6 | | | 10 (0)| 00:00:01 |
    |* 15 | TABLE ACCESS BY INDEX ROWID| FC_FFMTR_DAILY | 6 | 354 | | 12 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - access("METER_ID"="METER_ID")
    6 - access("GS"."SEGID"=584)
    8 - access("SM"."SEGID"=584)
    14 - access("M"."METER_NUMBER"="V"."METER_NUMBER")
    filter(TO_DATE(TO_CHAR("V"."MEASUREMENT_DAY"),'YYYYMMDD')>=TO_DATE(' 2002-01-01 00:00:00', 'syyyy-mm-dd
    hh24:mi:ss') AND TO_DATE(TO_CHAR("V"."MEASUREMENT_DAY"),'YYYYMMDD')<TO_DATE(' 2003-01-01 00:00:00', 'syyyy-mm-dd
    hh24:mi:ss'))
    15 - filter("V"."ADJUSTED_TOTAL_VOLUME"<>0.0 OR ROUND("V"."ADJUSTED_TOTAL_ENERGY",3)<>0.0)
    </code>
    As you can see there is a real spike in the cost and yet the only thing that was done was the addition of the Insert to GTT. From what I can ascertain the solution may be in an alternate SQL or finding some way to push Oracle into running the query as it would have for the first execution (non-insert).
    I tried creating a simple view out of the SELECT statement to see if that would precompile it but in the end it ran exactly the same way.
    The next thing that I am going to try is removing the PEAKS_RP_PEAKDAYMETER view by going more direct.
    I have not done the trace file analysis yet. Should I still do that?

  • Can global temporary  table work for me?

    Hi i recently found out about GTT, I first created a table and inserted values into my new_table but it was
    I have a report that I need to display a time range based on the time given in the report, now each page of the report shows a different time range. I created a formula that would insert into a new_table based on the value of the time range, I would then pull the values from the table to the report in a repeating frame, this caused the problem because data in table is overwriting the previous page values before it is displayed on the screen(there is a delete from table in the formula). This is my problem, how can I pull from the table before its deleted, will GTT work , if so How?

    I have no idea if it will work as you neglected to provide any code and any information about how you are producing the reports and with what tool.
    There are two types of global temporary tables. Do you know the difference?
    The docs are at http://tahiti.oracle.com
    Demos of both types in Morgan's Library at www.psoug.org
    After you've read the Oracle docs and understand how they work.
    And after you've run the Library demos.
    If you still have questions post them here along with sufficient information for someone not sitting next to you to know what you are doing.

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

  • Create global temporary table in delete trigger

    Hi to all, I am triyng to create a global temporary table in trigger so i can hold all the deleted rows and do some stuff after the statement which uses the table that fires the trigger.
    In this way I am trying to avod mutating table error. but the following trigger gives error.
    create or replace
    TRIGGER TD_EKSINAVLAR
    FOR DELETE ON DERSSECIMI_EKSINAVLAR
    COMPOUND TRIGGER
    BEFORE STATEMENT IS
    BEGIN
    CREATE GLOBAL TEMPORARY TABLE DELETED_ROWS
    AS ( SELECT * FROM DERSSECIMI_EKSINAVLAR WHERE 1 = 2 )
    ON COMMIT DELETE ROWS;
    END BEFORE STATEMENT;
    BEFORE EACH ROW IS
    BEGIN
    NULL;
    END BEFORE EACH ROW;
    AFTER EACH ROW IS
    BEGIN
    NULL;
    END AFTER EACH ROW;
    AFTER STATEMENT IS
    BEGIN
    NULL;
    END AFTER STATEMENT;
    END TD_EKSINAVLAR;
    the error is
    Error(12,5): PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: ( begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge
    Please help me about the situation.
    Thanks in advance.
    Gokhan

    Karthick you are absolutly right
    Our main process is to migrate sql server 2000 database to oracle 11g and I am stuck with the triggers that reference to table that fires the trigger itself.
    Can you help me about how i can overcome mutating table errors using compund triggers? Espacially for the situation that one statement tries to update or delete multiple rows on a table.
    You can understand my logic from the above code. I want to hold all the affected rows in a table and in after statement body using a cursor on that table I want to do required changes on the table. How can I do that or how should I do ?
    regards.

  • Global Temporary Table (and more)

    Hi every one,
    here's the scenario:
    My database version is Oracle 9i.
    I have two Global Temporary Tables (GTT). I want to insert into those two tables (using a SELECT statement for each table) and then to use a SELECT statement to select from the two tables and the result sent to Report Builder 6i.
    Now, i guess i could use a Stored Procedure (SP) to insert into those tables and then use a SYS_REFCURSOR to return from this SP. The problem with that is Report Builder 6i does not recognise SYS_REFCURSOR types; it requires actual rows to be returned.
    So, my question is:
    Is there any way to insert into the two GTT first (using Select statements with Insert) and then select from the two tables, all in a single SELECT statement(In any case, a statement must be present that returns actual rows)?
    Additionally, one may run the report more than once (not necessarily after issuing a COMMIT or logging out), which means, the two GTT will be filled again and again. So, i will have to Truncate the GTT every time before Inserting.
    Efficiency of the query/solution is very important too as the data involved can consist of up to 2,00,000 records.
    Any suggestions will be greatly appreciated.
    Thank u.

    Here is some more detail:
    Q1////This statement handles INSERT for one GTT. Data inserted consists of multiple data selected from tables other than POLICY which is used by stored proc MANPOWER (in Q2).
    INSERT INTO TEMP1_NewBusiness
    SELECT ORG1, ORG2, (SELECT NAME FROM ORGANISER WHERE CODE=ORG1), ...,
    FROM POLICY
    WHERE DATCOM = '2007';
    Q2////This handles INSERT for second GTT
    INSERT INTO TEMP2_MANPOWER
    SELECT ORG1, MANPOWER(ORG1)
    FROM TEMP1_NewBusiness;
    /////Table POLICY is a normal table.
    MANPOWER is a stored proc which performs a string aggregation, using a cursor, by selecting from TEMP1.NBS. Because of the volume of data involved and the number of Selects, i'm using the GTT TEMP1.NBS as source for Manpower's data.
    So, first i need these two statements to be executed so that my GTTs are filled.
    Next, i want the result of query below sent to Report Builder.
    Q3.
    SELECT A.ORG1, A.ORG2, ..., B.MANPOWER
    FROM TEMP1.NewBusiness A, TEMP2.MANPOWER B
    WHERE A.ORG1 = B.ORG1;
    Now, i could place Q3 in the Report, but how do i get Q1 and Q2 to be executed first.
    Hope the situation is a little more clear now.
    I understand where you are coming from DAMORGAN and duplication is something i want to avoid myself.
    Thank u.

Maybe you are looking for

  • What is the next step after editing or triming a video ? What type of file format to save and what to do after that ?

    what is the next step after editing or triming a video? what type of file format should be save and what to do after that?

  • Can't print PDF file with "Technical" font

    Having a problem here. Any PDF file I get that includes the font "Technical" will not print on my HP laserjet. It displays perfectly, but won't print at all. I do have "Technical.ttf" and "Technical_Italic.ttf" in Library->Fonts folder, and they show

  • Adding Formulas to Substitution Variables

    Hi All, I am using EPM system 11. I have a classic planning application . On my dataform , I have Year in the Point Of View and Period on Column. I need to show Current Year,Next Year and Current Month (derived from system date) on the form. For achi

  • Profile creation problem on n85

    i have the same problem;can't create new profile on my n85 (v30.101) "please help me!" =]Does Nokia have any solution for this problem?

  • Buttons in Photoshop

    I am trying to create my own buttons in Photoshop, but whenever I save it as a .PSD file and import it into DVDSP the hightlighting option does not work with it, by that I mean it will now show any indications when the button is highlighted or select