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.

Similar Messages

  • How can i write the trigger for Global Temporary Table

    Hi Grus,
    How can i write the trigger for Global Temporary Table.
    I was created the GTT with trigger using the below script .
    CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
    EMP_C_NAME VARCHAR2(20 BYTE)
    ON COMMIT PRESERVE ROWS;
    CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
    BEFORE DELETE OR UPDATE OR INSERT
    ON GLOBAL_TEMP
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
    END;
    trigger was create successfully, but the wouldn't insert into to EMPNAME Table..
    Please guide whether am correct or not? if not kindly give a correct syntax with example
    Thanks in Advance,
    Arun M M

    BEGIN
    INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
    END;
    you are referencing old value in insert stmt.
    BEGIN
    INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
    END;then run ur application it works fine...
    CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
    EMP_C_NAME VARCHAR2(20 BYTE)
    ON COMMIT PRESERVE ROWS;
    CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
    BEFORE DELETE OR UPDATE OR INSERT
    ON GLOBAL_TEMP
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo');
    INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
    dbms_output.put_line(:OLD.EMP_C_NAME);
    END;
    create table EMPNAME as select * from GLOBAL_TEMP where 1=2
    insert into GLOBAL_TEMP values('fgfdgd');
    commit;
    select * from GLOBAL_TEMP;
    select * from EMPNAME;
    output:
    1 rows inserted
    commit succeeded.
    EMP_C_NAME          
    fgfdgd              
    1 rows selected
    EMP_C_NAME          
    fgfdgd              
    1 rows selectedgot it Arun
    Edited by: OraclePLSQL on Dec 28, 2010 6:07 PM

  • Create view for Global Temporary Table

    if view is create for global temporary table so exactly how it works which helps regarding application performance.
    Regaards,
    Sambit Ray

    A view is just a stored query. It can be on global temporary tables or regular one, makes no difference.

  • What to fill in "temp table scope" for global temporary tables?

    Hi,
    I'm using Data Modeler 4.0.1.836 and whatever I put in the "temp table scope" box for a global temporary table doesn't seem to affect the DDL script regarding the ON COMMIT PRESERVE/DELETE ROWS option. The script always shows ON COMMIT PRESERVE ROWS no matter what.
    Yet, some of my temporary tables must be created as ON COMMIT DELETE ROWS.
    The Data Modeler help says the following about this :
    Temp Table Scope:
    For a table classified as Temporary, you can specify a scope, such as Session or Dimension.
    Not sure what "Dimension" has to do with the scope here, but it doesn't make any difference.
    I tried putting "Session", "Dimension", "Transaction", but no luck. So what's the text to put for the script to generate ON COMMIT DELETE ROWS?
    Thanks

    Hi,
    The Temporary Table Scope property (on the Classification Types page of the Table Properties dialog) is purely documentary.
    To set ON COMMIT DELETE ROWS you should expand the Browser node for the Relational Model and look for the node for the relevant Oracle Physical Model.  If you expand this you will find an entry there for your Table. Double-click on this to get the Physical Model properties dialog for your table, and you will find a "Temporary"  property which has options YES (Preserve Rows), YES (Delete Rows) or NO.
    David

  • Can I use several adapters for polling multi tables

    Hi,
    I need to have 100 db polls.
    Can I use one bpel to recive data, is there any way to reduce the nunber of bpels ?
    Regards

    Maybe if you use a view that does a union on all tables. But I would not recommend this as you may get a massive performance hit. Use the DB Poll functionality to poll off the view.
    In your test case I would imagine that each table gets different information therefore each data set should be managed separately therfore you will have to 100 BPEL processes anyway.
    cheers
    James

  • Galaxy S3 4.1.2 - Can I use a SIM for global data in Italy?

    I have a Galaxy S3 that has been updated to 4.1.2 and I'm wondering if I can buy a local SIM card for Italy and be able to use it for data while I'm there?
    I've read countless discussions about the issues with the Galaxy S3 and it not being able to use another carrier's SIM card internationally, but I don't know if that changed since the update to 4.1.2.
    So, what are my options if I want to use my Galaxy S3 in Italy in a couple months?
    I see that Verizon will sell me 100MB of data for $25, but will that work flawlessly and act just as if I were using it here in the US? I mainly want to be able to use any apps and internet just as I can here in the US, so if I could get some options, I'd really appreciate the help!!
    Thanks

    I have a Galaxy S3 that has been updated to 4.1.2 and I'm wondering if I can buy a local SIM card for Italy and be able to use it for data while I'm there?
    I've read countless discussions about the issues with the Galaxy S3 and it not being able to use another carrier's SIM card internationally, but I don't know if that changed since the update to 4.1.2.
    So, what are my options if I want to use my Galaxy S3 in Italy in a couple months?
    I see that Verizon will sell me 100MB of data for $25, but will that work flawlessly and act just as if I were using it here in the US? I mainly want to be able to use any apps and internet just as I can here in the US, so if I could get some options, I'd really appreciate the help!!
    Thanks

  • How can I use create/createInsert for two different tables

    Hi All,
    I am showing different fields in the UI from different tables. I am able to fetch the data from all the tables and able to modify and save the data.
    Now, the problem when I want to create/insert some data into those columns(from different tables) I am facing issues.
    How can I proceed further??

    Hi Shay,
    Thank you very much for your quick response.
    Actually I am totally new in ADF world and I am trying to implement some applications in ADF.
    I created an UI based on some 3 tables(there is foreign key relation between them) and some other tables. I am able to modify and save my application if there is any data in all the tables.
    My Actual issues are
    1) I removed all the data from the tables. There is a submit(CreateInsert) button, what I expected is on click of the button I should see all the fields in editable mode. But I was able to see only few fields and also in readonly mode. So here my issue is how can i create and save these data.
    2) Consider on my landing page I have just CommandLink/CommandButton. After clicking that page I should get the above screen in create mode(I mean to say all fields in editable mode). How can achieve this?
    Thanks & Regards,
    Ravi.

  • Global temporary table screwing up execution plan

    Hello
    I have a process I'm trying to optimise. The first part of the process opens a cursor, bulk collects, and then inserts the data into a table using FORALL. The next part uses another FORALL statement to insert into another table, using 4 of those collections populated by the bulk collect to control a select statement i.e.
    FORALL i IN 1..Collection1.COUNT
        INSERT
        INTO
             table
        SELECT
             t1.col1,
             t2.col2,
             t3.col3,
             Collection4(i)
        FROM
           table1 t1,
           table2 t2,
           table3 t3
        WHERE
           t1.pk = Collection1(i)
        AND
           t2.fk = t1.pk
        AND
           t3.fk = t1.pk;This statement is executed 50k+ times and takes about an hour. The execution plan for the select is fine, the time is just down to the number of itterations. Anyway, to try and make this quicker, I created a global temporary table to store the contents of the collections of interest, and then in a new cursor using the above select (replacing the collections with the columns in the temporary table), I bulk collect that into new collections and do the inserts. The problem is, that the optimiser assumes that the temporary table has 2 million+ rows in it for some strange reason, and so this completely changes the executions plan to give a cost of 180k! I can't analyze a temporary table so does anyone have an idea as to what I can do to make this work and bring the cost down to something more reasonable? Maybe an alternative strategy?
    Cheers

    <<I can't analyze a temporary table>>
    What version of Oracle do you use?
    SQL> create global temporary table mytable(col1 number,
      2  col2 date) on commit preserve rows;
    Table created.
    SQL> begin
      2  for i in 1..1000 loop
      3  insert into mytable values(i,sysdate);
      4  end loop;
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL> select count(1) from mytable;
      COUNT(1)
          1000
    SQL> set autot traceonly
    SQL> select count(1) from mytable;
    Execution Plan
       0      SELECT STATEMENT Optimizer=RULE
       1    0   SORT (AGGREGATE)
       2    1     TABLE ACCESS (FULL) OF 'MYTABLE'
    Statistics
              0  recursive calls
              0  db block gets
              5  consistent gets
              0  physical reads
              0  redo size
            199  bytes sent via SQL*Net to client
            277  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> ALTER SESSION SET OPTIMIZER_GOAL = ALL_ROWS;
    Session altered.
    SQL>  select count(1) from mytable;
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=11 Card=1)
       1    0   SORT (AGGREGATE)
       2    1     TABLE ACCESS (FULL) OF 'MYTABLE' (Cost=11 Card=8168)
    Statistics
              5  recursive calls
              0  db block gets
             10  consistent gets
              0  physical reads
              0  redo size
            211  bytes sent via SQL*Net to client
            277  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              2  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL>
    SQL> ANALYZE TABLE MYTABLE COMPUTE STATISTICS;
    Table analyzed.
    SQL> select count(1) from mytable;
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1)
       1    0   SORT (AGGREGATE)
       2    1     TABLE ACCESS (FULL) OF 'MYTABLE' (Cost=2 Card=1000)
    Statistics
              0  recursive calls
              0  db block gets
              5  consistent gets
              0  physical reads
              0  redo size
            210  bytes sent via SQL*Net to client
            277  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.3.0 - Production

  • I download ios8 I can't use my song for ringtone and other ringtone it is not loud and I miss call

    I Download ISO 8 and I can't use the song for my ringtone , but it vibrate and I can't hear the phone rings . Other ringtone it is not loUd

    There is a difference between the passcode and the sync key.<br />
    The passcode allows to setup all sync parameters with a single code on other devices.<br />
    To enter the sync key (and user name and password) you need to click on "I don't have the device with me" at the bottom of the "Add a Device" window (Click Connect).
    * https://support.mozilla.com/kb/where-can-i-find-my-firefox-sync-key
    * https://support.mozilla.com/kb/find-code-to-add-device-to-firefox-sync

  • Global Temporary table and REDO

    Dear Friends,
    In my production database we are facing problem of excessive redo generation. After initial analysis, we realised that we are using a lot global temporary tables for storing temp data/calculations and they are generating redo.
    I know that GTT doesn’t create redo but as it creates UNDO and undo is protected by redo therefore it creates some redo but lesser than normal table.
    Solution:
    I google and found that if I use direct path insertion (using APPEND hint) into Global temporary table the I can avoid this redo generation as specified in this link (http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:15826034070548)
    I tried this solution in my GTT but its not making any difference with APPEND clause. Please check following results. Could you please guide me if I am doing something wrong or any other way to avoid redo on GTT.
    JM@ORA10G>insert into JM_temp values(1,'aaaaaaaaaaaaaaaaaaaaaaa');
    1 row created.
    Elapsed: 00:00:00.00
    Execution Plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | INSERT STATEMENT | | 1 | 100 | 1 (0)| 00:00:01 |
    Statistics
    0 recursive calls
    2 db block gets
    1 consistent gets
    0 physical reads
    *280 redo size*
    918 bytes sent via SQL*Net to client
    967 bytes received via SQL*Net from client
    6 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    1     rows processed
    JM@ORA10G>rollback ;
    Rollback complete.
    JM@ORA10G>insert * into JM_temp values(1,'aaaaaaaaaaaaaaaaaaaaaaa');
    1 row created.
    Elapsed: 00:00:00.00
    Execution Plan
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | INSERT STATEMENT | | 1 | 100 | 1 (0)| 00:00:01 |
    Statistics
    0 recursive calls
    2 db block gets
    1 consistent gets
    0 physical reads
    *280 redo size*
    917 bytes sent via SQL*Net to client
    981 bytes received via SQL*Net from client
    6 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    1     rows processed

    Hi,
    I tried avoiding GTT in my code but I realised that they are so tightly integrated that i cannot remove them. Operations which I am perfroming on my GTT are
    1. Insertion of data
    2. Fetch data from main tables with joins on GTT
    3. Update GTT with calculated values.
    My understanding it Update steps are generating maximum redo.
    Please help me how can i reduce my redo generation in such scenarios.
    Thanks.

  • Problem creating index on global temporary table

    Running Oracle DB Oracle9i Release 9.2.0.7.0.
    I'm trying to create 3 indexes on a temporary table, the first index creates fine but the other remaining 2 result in the following error:
    ERROR at line 1: ORA-00600: internal error code, arguments: [kftts2bz_many_files], [0], [20], [], [], [], [], []
    Have tried searching with not much success, any pointers, tips, hints would be appreciated, below is the table and the indexes:-
    create global temporary TABLE contacts (
    ID VARCHAR2(20) NOT NULL,
    DOB VARCHAR2(8),
    HH_LASTNAME VARCHAR2(90),
    PERSON VARCHAR2(10) NOT NULL,
    CONT_JOB VARCHAR2(90) NOT NULL,
    SOURCE VARCHAR2(8) NOT NULL,
    ADS VARCHAR2(8) NOT NULL,
    CONT VARCHAR2(8) NOT NULL,
    SRCPERSONID VARCHAR2(15),
    FIRSTNAME VARCHAR2(90),
    MIDDLENAME VARCHAR2(90),
    LASTNAME VARCHAR2(90),
    FULLNAME VARCHAR2(90),
    TITLE VARCHAR2(50),
    SALUTATION VARCHAR2(90),
    ) on commit delete rows;
    create index i_contact_1 on contacts(dob, soundex(hh_lastname ));
    create index i_contact_pk on contacts(id, person, cont_job, source, ads, cont);
    create index i_contact_2 on contacts(srcpersonid, source);

    Bug 3238525 - Upgrade from 9.0 can leave corruptdata for global temporary table indices
    ORA-600 [kftts2bz_many_files]
         Doc ID:      285592.1

  • How to create index on Global Temporary Table?

    Hi,
    Can i create index with storage parameters on global temporary table? If possible, how?
    Thanks

    Yes. You can create an index on a global temporary table (GTT) with the regular 'CREATE INDEX' statement.
    Not sure though if you are allowed to locate it in a specific tablespace. Why would you want to do that anyway?
    My guess is, like the GTT, indexes on GTT's also default to the temporary tablespace.

  • How can i write a vi in using parallel port for digital inputs

    Dear all,
    i am a beginner user of LabVIEW and i want to write a vi in using parallel port for digital I/O. After reading the article "Using the Parallel Port in LabVIEW
    " and download the parallel.zip, i know how to write the vi for output, but i still don't know how to write the input one.i've try to use a Inport.vi to test, but nothing change when i set pin2-9 to high. (my computer:win2K & LabVIEW 6.1)
    Can anybody teach me how to write it?
    Can anyone write the vi for me too?
    Thanks all!
    p.s.i've already install the "accessHW.exe"

    Are you using VISA or the accessHW VIs? You may need to goto the bios and set the parallel port to run in spp mode or standard mode. This is the simpliest configuration and where you should start.
    As far as writing the VI goes, just copy the diagram out of the tutorial you mentioned.

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

  • 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

Maybe you are looking for

  • How to edit a datagridview/textboxes using tableadapters in c# and sql

    I am wondering what is the best way to edit a database that has multiple tables.  (Section 1) I have a Administration, Teacher and Student table that is linked up with the Person table which has a Primary Key.  The Person table consists of the genera

  • How to add new email account that's not an email account?

    I have Google Apps for business account and I've created a bunch of aliases that I need to have, let's take as an example info@<mydomain.com>. When I've tried to create gmail account info@<mydomain.com> I was getting info that this email address is a

  • Item description

    hai below this query i want to add pch1 item description field how do i will add??? this is the outgoing payment report SELECT T0.DocNum, t1.groupcode, t2.GroupName, T0.DocDate, T0.CardName,T0.CheckAcct, T0.CheckSum, T0.TrsfrAcct, T0.TrsfrSum, T0.Doc

  • E-Mail Access

    In the last couple of days I have been unable to access my e-mails, either through Outlook on my PC or through my Android phone.  My Phone tells me that my password has been changed at the server (not by me!), and Outlook doesn't recognise the passwo

  • SAP ECC 6.0 Installation Requirements(mySAP ERP 2005)

    <b>Hi., How much space needed for SAP ECC6.0.Recently I am trying to install.,but where can I get information about requirements, thanks, Raja ([email protected])</b>