Returning a ref cursor on a Global Temporary table

I realize this is probably not feasible but I am manipulating data and storing it in a GTT and I wish to return that transformed data out as a ref cursor is this possible to do? I also dont want a static table because this is a heavily hit procedure and I do not want to have to keep track of which session is which data not to mention contention between them.
I am using Oracle 10g on Windows server 2008

You will be able to see the records in the refcursor in the same session
Example
SQL> create global temporary table X_GTT as select * from emp where 1=2;
Table created.
SQL> insert into x_GTT select * from emp ;
14 rows created.
SQL> var rf refcursor ;
SQL> begin
  2    open :rf for select * from X_GTT ;
  3  end ;
PL/SQL procedure successfully completed.
SQL> print rf
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17-DEC-80        800                    99
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
14 rows selected.SS

Similar Messages

  • How to return a ref cursor from this dbms_sql?

    Hi,
    Can anyone show me how to return a ref cursor from this dbms_sql based procedure? I see 11g has a dbms_sql.to_refcursor(cursor_handle). How can this be done is 10g?
    Thx.
    CREATE OR REPLACE PROCEDURE Sample_Get_t
    p_sample_id sample.sample_id%TYPE,
    p_contract_id sample.contr_id%TYPE
    IS
    cursor_handle INT;
    sql_stmnt varchar2(500);
    rows_processed NUMBER;
    BEGIN
    sql_stmnt :=
    'SELECT
    sample_id,
    contr_id,
    rcpt_id
    FROM
    sample s
    WHERE
    s.contr_id = :1
    and s.sample_id = :2
    ORDER BY
    sample_id';
    cursor_handle := dbms_sql.open_cursor;
    dbms_sql.parse(cursor_handle, sql_stmnt, dbms_sql.native);
    dbms_sql.bind_variable(cursor_handle, ':1', p_contract_id);
    dbms_sql.bind_variable(cursor_handle, ':2', p_sample_id);
    rows_processed := dbms_sql.execute(cursor_handle);
    dbms_sql.close_cursor(cursor_handle);
    END Sample_Get_t;

    In 10 this cannot be done with dbms_sql (to my knowledge). There are a couple of other options.
    1) open the ref cursor for the dynamic statement using bind variables (or SYS_CONTEXT variables, which i prefer since they are much easier to deal with when you are dynamically adding predicates).
    declare
       wRefCursor  SYS_REFCURSOR;
    begin
       open wRefCursor for 'select * from all_objects where owner = :Logged_in_user' using user;
    end;
    /or using the context (the context will bind for you)
    declare
       wRefCursor  SYS_REFCURSOR;
    begin
       open wRefCursor for 'select * from all_objects where owner = SYS_CONTEXT(''CONTEXT_NAME'', ''VARIABLE_NAME'') ';
    end;
    /Be aware that contexts ALWAYS return varchar values, so if you are comparing to a number you should wrap it in TO_NUMBER, a date, TO_DATE and so on....
    2) change the DBMS_SQL to do an insert into a global temporary table and return the ref cursor which select's * from GTT;
    3) upgrade to Oracle 11 :)

  • Function call returned in ref cursor

    We have a ref cursor that calls a function in a package. When ODP.NET reads the cursor, it can't see what the function is returning. OO4O works fine, and if I take the sql that populates the ref cursor and put it into a temporary table, then select from that temporary table to return the ref cursor to ODP, it works fine. Anyone else seen this issue? Any help would be appreciated. Thanks.
    Eric Schrauth
    [email protected]

    Did you set the parameter direction to be ParameterDirection.Input when you created the parameter? Post your code.

  • Plsql use a function which returns a ref cursor

    Hi
    I've been using an function which returns a ref cursor. I've been returning this into a java resultset. Fine!
    Now i'm in plsql and want to use the same function. I'm not sure how to get this resultset in plsql.

    It's not very practical to use a refcursor like you want to, but here you go
    create or replace function test_ref
    return sys_refcursor
    is
    v_rc sys_refcursor;
    begin
    open v_rc for select emp_name  from emp ;
    return v_rc;
    end;
    declare
    v_rc sys_refcursor;
    v_emp_name emp.emp_name%type;
    begin
    v_rc :=  test_ref ;
    loop
        fetch v_rc into v_emp_name ;
        exit when v_rc%notfound ;
        dbms_output.put_line('Employee Name: '||v_emp_name );
    end loop;
    end;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Procedure to RETURN a REF CURSOR

    Environment:
    OWB10g Client on Windows XP Professional
    Repository - 9.2.0.4 on UNIX (AIX 5.2)
    Target - 9.2.0.4 on UNIX (AIX 5.2)
    Is it possible to create a PROCEDURE in OWB that returns a REF CURSOR?
    It was not one of the TYPEs available when specifying the procedure parameters.
    Is this an enhancement that's coming if it's not possible today?
    Many thanks for all feedback. This is a great interactive discussion forum.
    Gary

    Good afternoon Gary,
    Have you checked whether it's possible to use the table-function?
    Don't know you specific requirements, but according to the explanation ("Table functions extend PL/SQL and are a new option in Oracle9i. This option allows a function to accept, process and return multiple rows.") it at least is capable of returning rowtypes.
    Cheers, Patrick

  • Oracle Function returns a Ref Cursor to a ResultSet object - Performance

    My program calls an Oracle PL/SQL function which returns a ref cursor to a ResultSet object. I know that the function runs to completion relatively quickly when i run it in an anonymous block but when the call is made through my Java application the resultset takes about 30 mins to return. Below is a snippet of my code:
    currentConnection = ConnectionManager.getInstance().getConnection();
    reportStmt = currentConnection.prepareCall("BEGIN ? := ENVISION.PKG_WMS_TO_AP.F_REPORT_CI_SC_HOLDING(?,?); END;"); reportStmt.registerOutParameter(1, OracleTypes.CURSOR);
    reportStmt.setString(2, invoice.getCrewHQ());
    reportStmt.setDate(3, invoice.getWrCompletionDate());
    reportStmt.execute();
    reportRS = ((OracleCallableStatement) reportStmt).getCursor(1);
    Through a debugger I see that the second last statement (reportStmt.execute()) runs quickly. It is only when I step into the last statement that the debugger takes up to 30 minutes.
    Any thoughts?

    Flynn,
    The Internet is a dynamic place. After nearly two and a half years, there is a chance that a link will change. This is the new URL for the relevant Web page:
    http://asktom.oracle.com/~tkyte/ResultSets/
    Good Luck,
    Avi.

  • Global Temporary Table - Nulls Returned.

    Hello,
    I have written a search, which has one text box and scans across many different fields in a table. If you have multiple search terms separated by commas, I look for the results to have BOTH. The same would apply for even more search terms.
    To accomplish this I do the following:
    -- 1.) split the string with function, receive array of search terms.
    -- 2.) LOOP: Open Loop and move to first element of Array.
    -- 3.) find individual term (array element) in table (fields in question use CONTEXT indexing).
    -- 4.) Place list of results (PK) into Global Temporary table.
    -- 5.) Move to next array position.
    -- 6.) Repeat steps 3,4,5 until array is exhausted
    -- 7.) END LOOP:
    -- 8.) select PK list having COUNT(*) = # of terms in array.
    -- 9.) Select data from main table where pk in (list of terms from temp table).
    The procedure works fine in PL/SQL Developer and Toad. The results are reliable and accurate.
    When we try to run this through JDeveloper - we have problems. Either we get a return set of "NULL", or we get odd results that imply that the search has run through only one term of the two.
    We have researched this and setAutoCommit off.
    I am reaching out for suggestions on additional things which might be interfering with the Java connection, before I attempt to place a support call to Oracle.

    Not sure were can help you as this its a complicated use case which can't be rebuild easily by us.
    Still, you should medium your jdev version and how you call the pl /sql function which produces three results in the global Temp table.
    Can you please explain when exactly you get null or funny results?
    I have worked with temp take a while back and had no such issues.
    Timo

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

  • 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

  • HELP global temporary table ----URGENT

    HI ALL,
    create global temporary table FLIGHT_SCHEDULE ( STARTDATE DATE, ENDDATE DATE, COST NUMBER ) on commit preserve rows;
    I a not able to get return value in cursor
    but if this table is normal i.e. not temprary then it is returnng cursor
    ORA-24338 statment handel not exucuted error comming
    Please help
    Regards

    The code you posted looks alright.
    Perhaps you did not post the code with the problem?

  • Deadlock with CREATE GLOBAL TEMPORARY TABLE

    I got this error
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00060: deadlock detected while waiting for resource
    while trying to create global temporary table.
    Table creation command:
    CREATE GLOBAL TEMPORARY TABLE ITUSER.T_0091FBDG ("GOD" char(4) DEFAULT (' ') NOT NULL,"UNKUM" number(10,0) DEFAULT (0) NOT NULL,[a lot of other fields]) ON COMMIT PRESERVE ROWS
    There is no outer references in command. So does somebody know where does deadlock come from?
    I'm using Oracle 10g.
    Edited by: LeopoldStoch on Apr 13, 2010 7:04 AM

    I have grabbed log files. But it make me even more curious. Here it is:
    alert_itdb.log
    Thread 1 advanced to log sequence 253 (LGWR switch)
    Current log# 1 seq# 253 mem# 0: C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\REDO01.LOG
    Tue Apr 13 10:53:09 2010
    Thread 1 advanced to log sequence 254 (LGWR switch)
    Current log# 2 seq# 254 mem# 0: C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\REDO02.LOG
    Tue Apr 13 10:55:32 2010
    Thread 1 advanced to log sequence 255 (LGWR switch)
    Current log# 3 seq# 255 mem# 0: C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\REDO03.LOG
    Tue Apr 13 10:55:49 2010
    ORA-00060: Deadlock detected. More info in file c:\oracle\product\10.2.0\admin\itdb\udump\itdb_ora_3868.trc.
    Tue Apr 13 11:01:58 2010
    Thread 1 advanced to log sequence 256 (LGWR switch)
    Current log# 1 seq# 256 mem# 0: C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\REDO01.LOG
    Tue Apr 13 11:03:29 2010
    Thread 1 advanced to log sequence 257 (LGWR switch)
    Current log# 2 seq# 257 mem# 0: C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\REDO02.LOG
    Tue Apr 13 11:14:16 2010
    itdb_ora_3868.trc
    Dump file c:\oracle\product\10.2.0\admin\itdb\udump\itdb_ora_3868.trc
    Tue Apr 13 10:55:48 2010
    ORACLE V10.2.0.4.0 - Production vsnsta=0
    vsnsql=14 vsnxtr=3
    Oracle Database 10g Release 10.2.0.4.0 - Production
    Windows NT Version V5.2 Service Pack 2
    CPU : 2 - type 586, 1 Physical Cores
    Process Affinity : 0x00000000
    Memory (Avail/Total): Ph:3568M/8188M, Ph+PgF:7889M/12090M, VA:579M/2799M
    Instance name: itdb
    Redo thread mounted by this instance: 1
    Oracle process number: 18
    Windows thread id: 3868, image: ORACLE.EXE (SHAD)
    *** 2010-04-13 10:55:48.874
    *** ACTION NAME:() 2010-04-13 10:55:48.811
    *** MODULE NAME:(5436,20100413105316,82100) 2010-04-13 10:55:48.811
    *** SERVICE NAME:(ITDB) 2010-04-13 10:55:48.811
    *** SESSION ID:(145.52602) 2010-04-13 10:55:48.811
    DEADLOCK DETECTED ( ORA-00060 )
    [Transaction Deadlock]
    The following deadlock is not an ORACLE error. It is a
    deadlock due to user error in the design of an application
    or from issuing incorrect ad-hoc SQL. The following
    information may aid in determining the deadlock:
    Deadlock graph:
    ---------Blocker(s)-------- ---------Waiter(s)---------
    Resource Name process session holds waits process session holds waits
    TX-00080011-0000198d 18 145 X 17 158 S
    TX-0006001c-0000192d 17 158 X 18 145 S
    session 145: DID 0001-0012-00000164 session 158: DID 0001-0011-000005F5
    session 158: DID 0001-0011-000005F5 session 145: DID 0001-0012-00000164
    Rows waited on:
    Session 158: obj - rowid = 00000000 - D/////AACAAAKy6AAA
    (dictionary objn - 0, file - 2, block - 44218, slot - 0)
    Session 145: obj - rowid = 00000000 - D/////AACAAAABJAAA
    (dictionary objn - 0, file - 2, block - 73, slot - 0)
    Information on the OTHER waiting sessions:
    Session 158:
    pid=17 serial=2727 audsid=241067 user: 60/ITUSER
    O/S info: user: VSC03\it_appsrv, term: VSC03, ospid: 2328:2640, machine: WORKGROUP\VSC03
    program: AppServer.exe
    client info: ELIZ-041.R#046IKSANOV.RIKSANOV.VSC03:8223.2328.5-1-2600.IT_APPSR
    application name: 5436,20100413105322,82000, hash value=3107059750
    Current SQL Statement:
    CREATE GLOBAL TEMPORARY TABLE ITUSER.T_009EFBDN ("GOD" char(4) DEFAULT (' ') NOT NULL,"UNKUM" number(10,0) DEFAULT (0) NOT NULL,"CENA" number(15,5) DEFAULT (0) NOT NULL,"EDI" number(3,0) NULL,"EDI2" number(3,0) NULL,"KOL" number(14,5) DEFAULT (0) NOT NULL,"KOL2" number(14,5) DEFAULT (0) NOT NULL,"SUMMA" number(16,2) DEFAULT (0) NOT NULL,"KOL_N1" number(14,5) DEFAULT (0) NOT NULL,"KOL_N2" number(14,5) DEFAULT (0) NOT NULL,"KOL_N3" number(14,5) DEFAULT (0) NOT NULL,"KOL_N4" number(14,5) DEFAULT (0) NOT NULL,"KOL_N5" number(14,5) DEFAULT (0) NOT NULL,"KOL_N6" number(14,5) DEFAULT (0) NOT NULL,"KOL_N7" number(14,5) DEFAULT (0) NOT NULL,"KOL_N8" number(14,5) DEFAULT (0) NOT NULL,"KOL_N9" number(14,5) DEFAULT (0) NOT NULL,"KOL_N10" number(14,5) DEFAULT (0) NOT NULL,"KOL_N11" number(14,5) DEFAULT (0) NOT NULL,"KOL_N12" number(14,5) DEFAULT (0) NOT NULL,"KOL_N13" number(14,5) DEFAULT (0) NOT NULL,"KOL2N1" number(14,5) DEFAULT (0) NOT NULL,"KOL2N2" number(14,5) DEFAULT (0) NOT NULL,"KOL2N3" number(14,5) DEFAULT (0) NOT NULL,"KOL2N4" number(14,5) DEFAULT (0) NOT NULL,"KOL2N5" number(14,5) DEFAULT (0) NOT NULL,"KOL2N6" number(14,5) DEFAULT (0) NOT NULL,"KOL2N7" number(14,5) DEFAULT (0) NOT NULL,"KOL2N8" number(14,5) DEFAULT (0) NOT NULL,"KOL2N9" number(14,5) DEFAULT (0) NOT NULL,"KOL2N10" number(14,5) DEFAULT (0) NOT NULL,"KOL2N11" number(14,5) DEFAULT (0) NOT NULL,"KOL2N12" number(14,5) DEFAULT (0) NOT NULL,"KOL2N13" number(14,5) DEFAULT (0) NOT NULL,"SUM_N1" number(16,2) DEFAULT (0) NOT NULL,"SUM_N2" number(16,2) DEFAULT (0) NOT NULL,"SUM_N3" number(16,2) DEFAULT (0) NOT NULL,"SUM_N4" number(16,2) DEFAULT (0) NOT NULL,"SUM_N5" number(16,2) DEFAULT (0) NOT NULL,"SUM_N6" number(16,2) DEFAULT (0) NOT NULL,"SUM_N7" number(16,2) DEFAULT (0) NOT NULL,"SUM_N8" number(16,2) DEFAULT (0) NOT NULL,"SUM_N9" number(16,2) DEFAULT (0) NOT NULL,"SUM_N10" number(16,2) DEFAULT (0) NOT NULL,"SUM_N11" number(16,2) DEFAULT (0) NOT NULL,"SUM_N12" number(16,2) DEFAULT (0) NOT NULL,"SUM_N13" number(16,2) DEFAULT (0) NOT NULL,"DATE_REST" date NULL,"KOL_PRI" number(14,5) DEFAULT (0) NOT NULL,"KOL2PRI" number(14,5) DEFAULT (0) NOT NULL,"SUM_PRI" number(16,2) DEFAULT (0) NOT NULL,"DATE_FPRI" date NULL,"NDOC_FPRI" char(20) DEFAULT (' ') NOT NULL,"KOL_PRIG" number(14,5) DEFAULT (0) NOT NULL,"KOL2PRIG" number(14,5) DEFAULT (0) NOT NULL,"SUM_PRIG" number(16,2) DEFAULT (0) NOT NULL,"KOL_PRIT" number(14,5) DEFAULT (0) NOT NULL,"KOL2PRIT" number(14,5) DEFAULT (0) NOT NULL,"KOL_RAS" number(14,5) DEFAULT (0) NOT NULL,"KOL2RAS" number(14,5) DEFAULT (0) NOT NULL,"SUM_RAS" number(16,2) DEFAULT (0) NOT NULL,"DATE_LRAS" date NULL,"NDOC_LRAS" char(20) DEFAULT (' ') NOT NULL,"KOL_RASG" number(14,5) DEFAULT (0) NOT NULL,"KOL2RASG" number(14,5) DEFAULT (0) NOT NULL,"SUM_RASG" number(16,2) DEFAULT (0) NOT NULL,"KOL_RAST" number(14,5) DEFAULT (0) NOT NULL,"KOL2RAST" number(14,5) DEFAULT (0) NOT NULL,"KOL_PRIREZ" number(14,5) DEFAULT (0) NOT NULL,"KOL2PRIREZ" number(14,5) DEFAULT (0) NOT NULL,"SUM_PRIREZ" number(16,2) DEFAULT (0) NOT NULL,"KOL_RASREZ" number(14,5) DEFAULT (0) NOT NULL,"KOL2RASREZ" number(14,5) DEFAULT (0) NOT NULL,"SUM_RASREZ" number(16,2) DEFAULT (0) NOT NULL,"PRC_RAS" number(3,0) DEFAULT (0) NOT NULL,"KSSM" char(5) NULL,"COMM" char(40) DEFAULT (' ') NOT NULL,"KDM3" char(1) DEFAULT (' ') NOT NULL,"KDM4" char(1) DEFAULT (' ') NOT NULL,"KOL_INV" number(14,5) DEFAULT (0) NOT NULL,"KOL2INV" number(14,5) DEFAULT (0) NOT NULL,"CENA_INV" number(15,5) DEFAULT (0) NOT NULL,"SUM_INV" number(16,2) DEFAULT (0) NOT NULL,"DATE_INV" date NULL,"KSBG" char(3) DEFAULT (' ') NOT NULL,"KOL_C" number(14,5) DEFAULT (0) NOT NULL,"KOL2C" number(14,5) DEFAULT (0) NOT NULL,"SUM_C" number(16,2) DEFAULT (0) NOT NULL,"KBLS" char(5) DEFAULT (' ') NOT NULL,"BS_ZATR" char(10) NULL,"KAU_ZATR" char(12) DEFAULT (' ') NOT NULL,"MECEXPL" number(3,0) DEFAULT (0) NOT NULL,"SUM_IZNOS" number(14,2) DEFAULT (0) NOT NULL,"SUM_IMEC" number(14,2) DEFAULT (0) NOT NULL,"NINKAS" number(10,0) DEFAULT (0) NOT NULL,"DATE_D" date NULL,"FIO_D" char(10) DEFAULT (' ') NOT NULL,"DATE_K" date NULL,"FIO_O" char(10) DEFAULT (' ') NOT NULL,"STDCURR" char(1) DEFAULT (' ') NOT NULL) ON COMMIT PRESERVE ROWS
    End of information on OTHER waiting sessions.
    Current SQL statement for this session:
    insert into col$(obj#,name,intcol#,segcol#,type#,length,precision#,scale,null$,offset,fixedstorage,segcollength,deflength,default$,col#,property,charsetid,charsetform,spare1,spare2,spare3)values(:1,:2,:3,:4,:5,:6,decode(:5,182/*DTYIYM*/,:7,183/*DTYIDS*/,:7,decode(:7,0,null,:7)),decode(:5,2,decode(:8,-127/*MAXSB1MINAL*/,null,:8),178,:8,179,:8,180,:8,181,:8,182,:8,183,:8,231,:8,null),:9,0,:10,:11,decode(:12,0,null,:12),:13,:14,:15,:16,:17,:18,:19,:20)
    ===================================================
    PROCESS STATE
    Process global information:
    process: 5F28A1F8, call: 5F3A8E98, xact: 5DFF8B40, curses: 5F37D6A8, usrses: 5F375F38
    SO: 5F28A1F8, type: 2, owner: 00000000, flag: INIT/-/-/0x00
    (process) Oracle pid=18, calls cur/top: 5F3A8E98/5F3A75B8, flag: (0) -
    int error: 0, call error: 0, sess error: 0, txn error 0
    (post info) last post received: 0 0 117
    last post received-location: kcbzww
    last process to post me: 5f289c00 93 0
    last post sent: 0 0 117
    last post sent-location: kcbzww
    last process posted by me: 5f289c00 93 0
    (latch info) wait_event=0 bits=0
    Process Group: DEFAULT, pseudo proc: 5F2BC4EC
    O/S info: user: SYSTEM, term: VSC03, ospid: 3868
    OSD pid info: Windows thread id: 3868, image: ORACLE.EXE (SHAD)
    Dump of memory from 0x5F276E78 to 0x5F276FFC
    5F276E70 0000000B 5E1231B8 [.....1.^]
    5F276E80 00000010 000313A9 5F3A75B8 00000003 [.........u:_....]
    5F276E90 000313A9 5F4B92D4 0000000B 000313A9 [......K_........]
    5F276EA0 5F375F38 00000004 0003129D 5DE1FFA4 [8_7_...........]]
    5F276EB0 00000007 000313A9 5DE20028 00000007 [........(..]....]
    5F276EC0 000313A9 5DE200BC 00000007 000313A9 [.......]........]
    5F276ED0 5DE20140 00000007 000313A9 5DE201C4 [@..]...........]]
    5F276EE0 00000007 000313A9 5DE20248 00000007 [........H..]....]
    5F276EF0 000313A9 5DE202CC 00000007 000313A9 [.......]........]
    5F276F00 00000000 00000000 00000000 00000000 [................]
    Repeat 14 times
    5F276FF0 00000000 00000000 00000000 [............]
    (FOB) flags=2 fib=5DEEEC98 incno=0 pending i/o cnt=0
    fname=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\UNDOTBS01.DBF
    fno=2 lblksz=8192 fsiz=311040
    (FOB) flags=2 fib=5DEEE608 incno=0 pending i/o cnt=0
    fname=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\CONTROL03.CTL
    fno=2 lblksz=16384 fsiz=430
    (FOB) flags=2 fib=5DEEE2C8 incno=0 pending i/o cnt=0
    fname=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\CONTROL02.CTL
    fno=1 lblksz=16384 fsiz=430
    (FOB) flags=2 fib=5DEEDF88 incno=0 pending i/o cnt=0
    fname=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\CONTROL01.CTL
    fno=0 lblksz=16384 fsiz=430
    (FOB) flags=2 fib=5DEEF658 incno=0 pending i/o cnt=0
    fname=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\ITDATA01.DBF
    fno=5 lblksz=8192 fsiz=2109440
    (FOB) flags=2 fib=5DEEE948 incno=0 pending i/o cnt=0
    fname=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\SYSTEM01.DBF
    fno=1 lblksz=8192 fsiz=79360
    (FOB) flags=2 fib=5DEEFCE8 incno=0 pending i/o cnt=0
    fname=C:\ORACLE\PRODUCT\10.2.0\ORADATA\ITDB\TEMP01.DBF
    fno=201 lblksz=8192 fsiz=43776
    SO: 5F375F38, type: 4, owner: 5F28A1F8, flag: INIT/-/-/0x00
    (session) sid: 145 trans: 5D06D4B0, creator: 5F28A1F8, flag: (8100041) USR/- BSY/-/-/-/-/-
    DID: 0001-0012-00000164, short-term DID: 0000-0000-00000000
    txn branch: 00000000
    oct: 1, prv: 0, sql: 50B2BAC0, psql: 57554078, user: 60/ITUSER
    service name: ITDB
    O/S info: user: VSC03\it_appsrv, term: VSC03, ospid: 3668:3616, machine: WORKGROUP\VSC03
    program: AppServer.exe
    client info: ELIZ-041.R#046IKSANOV.RIKSANOV.VSC03:8223.3668.5-1-2600.IT_APPSR
    application name: 5436,20100413105316,82100, hash value=3093400541
    last wait for 'enq: TX - allocate ITL entry' blocking sess=0x5F386200 seq=4256 wait_time=2999487 seconds since wait started=2
    name|mode=54580004, usn<<16 | slot=6001c, sequence=192d
    Dumping Session Wait History
    for 'enq: TX - allocate ITL entry' count=1 wait_time=2999487
    name|mode=54580004, usn<<16 | slot=6001c, sequence=192d
    for 'buffer busy waits' count=1 wait_time=10
    file#=1, block#=f923, class#=1
    for 'buffer busy waits' count=1 wait_time=53
    file#=1, block#=d1ff, class#=1
    for 'buffer busy waits' count=1 wait_time=36
    file#=1, block#=19, class#=4
    for 'buffer busy waits' count=1 wait_time=28
    file#=1, block#=19, class#=4
    for 'buffer busy waits' count=1 wait_time=27
    file#=1, block#=f923, class#=1
    for 'buffer busy waits' count=1 wait_time=13
    file#=1, block#=ec86, class#=1
    for 'buffer busy waits' count=1 wait_time=29
    file#=1, block#=f923, class#=1
    for 'buffer busy waits' count=1 wait_time=15
    file#=1, block#=f95d, class#=1
    for 'buffer busy waits' count=1 wait_time=215
    file#=1, block#=d1ff, class#=1
    temporary object counter: 1
    UOL used : 0 locks(used=2, free=10)
    KGX Atomic Operation Log 69405330
    Mutex 00000000(0, 0) idn 0 oper NONE
    Cursor Parent uid 145 efd 5 whr 11 slp 0
    oper=NONE pt1=A4744BC4 pt2=6842B2F4 pt3=A4744B94
    pt4=00000000 u41=0 stt=0
    KGX Atomic Operation Log 69405358
    Mutex 50B2BB74(0, 1) idn 0 oper NONE
    Cursor Stat uid 145 efd 8 whr 1 slp 0
    oper=NONE pt1=50B2BAC0 pt2=00000000 pt3=00000000
    pt4=00000000 u41=0 stt=8
    KGX Atomic Operation Log 69405380
    Mutex 00000000(0, 0) idn 0 oper NONE
    Library Cache uid 145 efd 0 whr 0 slp 0
    SO: 5C5A6334, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c5a6334 handle=5e9a6868 mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C5A6384[5C76A228,5C59D1D0] htb=5C59D1D0 ssga=5C59CD04
    user=5f375f38 session=5f37d6a8 count=1 flags=CBK[0020] savepoint=0x0
    LIBRARY OBJECT HANDLE: handle=5e9a6868 mtx=5E9A691C(0) cdp=0
    namespace=CRSR flags=RON/KGHP/PN0/EXP/[10010100]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=S latch#=1 hpc=c742 hlc=c742
    lwt=5E9A68C4[5E9A68C4,5E9A68C4] ltm=5E9A68CC[5E9A68CC,5E9A68CC]
    pwt=5E9A68A8[5E9A68A8,5E9A68A8] ptm=5E9A68B0[5E9A68B0,5E9A68B0]
    ref=5E9A68E4[662DCE3C,662DCE3C] lnd=5E9A68F0[5E9A68F0,5E9A68F0]
    LIBRARY OBJECT: object=51e6451c
    type=CRSR flags=EXS[0001] pflags=[0000] status=VALD load=0
    DEPENDENCIES: count=1 size=16
    AUTHORIZATIONS: count=1 size=16 minimum entrysize=18
    ACCESSES: count=1 size=16
    TRANSLATIONS: count=1 size=16
    DATA BLOCKS:
    data# heap pointer status pins change whr
    0 a1f966d4 51e645b4 I/P/A/-/- 0 NONE 00
    6 662dcce4 a24e2534 I/P/A/-/E 0 NONE 00
    KGX Atomic Operation Log 50C2014C
    Mutex 662DCC54(0, 2) idn d64ee82 oper SHRD
    Cursor Pin uid 145 efd 0 whr 3 slp 0
    opr=4 pso=5C5A6334 flg=0
    pcs=662DCC54 nxt=5B9C77F4 flg=18 cld=0 hd=5E9A6868 par=54763C50
    ct=2 hsh=0 unp=00000000 unn=0 hvl=662dcff0 nhv=0 ses=00000000
    hep=662DCCA0 flg=80 ld=1 ob=51E6451C ptr=A24E2534 fex=A24E16F8
    SO: 5C76A1D8, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c76a1d8 handle=5a67b168 mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C76A228[5C59D1D0,5C5A6384] htb=5C59D1D0 ssga=5C59CD04
    user=5f375f38 session=5f37d6a8 count=1 flags=[0000] savepoint=0x4bc41571
    LIBRARY OBJECT HANDLE: handle=5a67b168 mtx=5A67B21C(2) cdp=2
    name=
    insert into col$(obj#,name,intcol#,segcol#,type#,length,precision#,scale,null$,offset,fixedstorage,segcollength,deflength,default$,col#,property,charsetid,charsetform,spare1,spare2,spare3)values(:1,:2,:3,:4,:5,:6,decode(:5,182/*DTYIYM*/,:7,183/*DTYIDS*/,:7,decode(:7,0,null,:7)),decode(:5,2,decode(:8,-127/*MAXSB1MINAL*/,null,:8),178,:8,179,:8,180,:8,181,:8,182,:8,183,:8,231,:8,null),:9,0,:10,:11,decode(:12,0,null,:12),:13,:14,:15,:16,:17,:18,:19,:20)
    hash=012a6293ef607cee606b82dc0d64ee82 timestamp=04-08-2010 17:06:19
    namespace=CRSR flags=RON/KGHP/TIM/PN0/LRG/KST/DBN/MTX/[100100d1]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=0 latch#=1 hpc=c298 hlc=c298
    lwt=5A67B1C4[5A67B1C4,5A67B1C4] ltm=5A67B1CC[5A67B1CC,5A67B1CC]
    pwt=5A67B1A8[5A67B1A8,5A67B1A8] ptm=5A67B1B0[5A67B1B0,5A67B1B0]
    ref=5A67B1E4[5A67B1E4,5A67B1E4] lnd=5A67B1F0[5A67B1F0,5A67B1F0]
    LIBRARY OBJECT: object=54763bb8
    type=CRSR flags=EXS[0001] pflags=[0000] status=VALD load=0
    CHILDREN: size=16
    child# table reference handle
    0 662dd020 662dce3c 5e9a6868
    1 662dd020 5b9c7940 5eb1fdbc
    DATA BLOCKS:
    data# heap pointer status pins change whr
    0 54c98590 54763c50 I/P/A/-/- 0 NONE 00
    SO: 5C5AFBCC, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c5afbcc handle=6ad6312c mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C5AFC1C[5C61B52C,5C59D0B0] htb=5C59D0B0 ssga=5C59CD04
    user=5f375f38 session=5f37d6a8 count=1 flags=[0000] savepoint=0x0
    LIBRARY OBJECT HANDLE: handle=6ad6312c mtx=6AD631E0(0) cdp=0
    namespace=CRSR flags=RON/KGHP/PN0/EXP/[10010100]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=0 latch#=2 hpc=b9a0 hlc=b9a0
    lwt=6AD63188[6AD63188,6AD63188] ltm=6AD63190[6AD63190,6AD63190]
    pwt=6AD6316C[6AD6316C,6AD6316C] ptm=6AD63174[6AD63174,6AD63174
    SO: 5C5A5C34, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c5a5c34 handle=69731e20 mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C5A5C84[5C59D4D0,5C6074B0] htb=5C59D4D0 ssga=5C59CD04
    user=5f375f38 session=5f37d6a8 count=1 flags=[0000] savepoint=0x4bc41571
    LIBRARY OBJECT HANDLE: handle=69731e20 mtx=69731ED4(2) cdp=2
    name=update con$ set con#=:3 where owner#=:1 and name=:2
    hash=cb0043a665029adc35682cfd8f583ce2 timestamp=04-08-2010 17:10:17
    namespace=CRSR flags=RON/KGHP/TIM/PN0/SML/KST/DBN/MTX/[120100d0]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=0 latch#=2 hpc=ac50 hlc=ac50
    lwt=69731E7C[69731E7C,69731E7C] ltm=69731E84[69731E84,69731E84]
    pwt=69731E60[69731E60,69731E60] ptm=69731E68[69731E68,69731E68]
    ref=69731E9C[69731E9C,69731E9C] lnd=69731EA8[69731EA8,69731EA8]
    LIBRARY OBJECT: object=66177404
    type=CRSR flags=EXS[0001] pflags=[0000] status=VALD load=0
    CHILDREN: size=16
    child# table reference handle
    0 5887c454 5887c270 69641ffc
    1 5887c454 5887c400 693d29b4
    DATA BLOCKS:
    data# heap pointer status pins change whr
    0 57178070 6617749c I/P/A/-/- 0 NONE 00
    SO: 5C62D288, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c62d288 handle=5734d800 mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C62D2D8[5C59D590,5C59D590] htb=5C59D590 ssga=5C59CD04
    user=5f375f38 session=5f375f38 count=0 flags=LRU/[4000] savepoint=0x17ee5af
    LIBRARY OBJECT HANDLE: handle=5734d800 mtx=5734D8B4(0) cdp=0
    name=SYS._default_auditing_options_
    hash=fab1a450ca8625c88d7aa501cb042efa timestamp=03-14-2008 18:46:51
    namespace=TABL flags=KGHP/TIM/SML/[02000000]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=0 latch#=1 hpc=3e1e hlc=3e1e
    lwt=5734D85C[5734D85C,5734D85C] ltm=5734D864[5734D864,5734D864]
    pwt=5734D840[5734D840,5734D840] ptm=5734D848[5734D848,5734D848]
    ref=5734D87C[5734D87C,5734D87C] lnd=5734D888[5734D888,5734D888]
    LIBRARY OBJECT: object=69e8d9e4
    type=TABL flags=EXS/LOC[0005] pflags=[0000] status=VALD load=0
    DATA BLOCKS:
    data# heap pointer status pins change whr
    0 572f55b0 69e8da7c I/-/A/-/- 0 NONE 00
    SO: 5C62CA38, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c62ca38 handle=54e2b2d0 mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C62CA88[5C7875E0,5C59D458] htb=5C59D458 ssga=5C59CD04
    user=5f375f38 session=5f37d6a8 count=1 flags=[0000] savepoint=0x0
    LIBRARY OBJECT HANDLE: handle=54e2b2d0 mtx=54E2B384(0) cdp=0
    namespace=CRSR flags=RON/KGHP/PN0/EXP/[10010100]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=0 latch#=1 hpc=cb1c hlc=cb1c
    lwt=54E2B32C[54E2B32C,54E2B32C] ltm=54E2B334[54E2B334,54E2B334]
    pwt=54E2B310[54E2B310,54E2B310] ptm=54E2B318[54E2B318,54E2B318]
    ref=54E2B34C[66147E34,66147E34] lnd=54E2B358[54E2B358,54E2B358]
    LIBRARY OBJECT: object=51e651ac
    type=CRSR flags=EXS[0001] pflags=[0000] status=VALD load=0
    DEPENDENCIES: count=1 size=16
    AUTHORIZATIONS: count=1 size=16 minimum entrysize=18
    ACCESSES: count=1 size=16
    TRANSLATIONS: count=1 size=16
    DATA BLOCKS:
    data# heap pointer status pins change whr
    0 6a86de6c 51e65244 I/P/A/-/- 0 NONE 00
    6 66147cdc 9dabe588 I/-/A/-/E 0 NONE 00
    SO: 5C787590, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c787590 handle=57422b64 mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C7875E0[5C59D458,5C62CA88] htb=5C59D458 ssga=5C59CD04
    user=5f375f38 session=5f37d6a8 count=1 flags=[0000] savepoint=0x4bc41571
    LIBRARY OBJECT HANDLE: handle=57422b64 mtx=57422C18(2) cdp=2
    name=insert into obj$(owner#,name,namespace,obj#,type#,ctime,mtime,stime,status,remoteowner,linkname,subname,dataobj#,flags,oid$,spare1,spare2)values(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16, :17)
    hash=8876f3fed7222711572e6a76e623c9d3 timestamp=04-08-2010 17:06:19
    namespace=CRSR flags=RON/KGHP/TIM/PN0/MED/KST/DBN/MTX/[500100d0]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=0 latch#=1 hpc=60c0 hlc=60c0
    lwt=57422BC0[57422BC0,57422BC0] ltm=57422BC8[57422BC8,57422BC8]
    pwt=57422BA4[57422BA4,57422BA4] ptm=57422BAC[57422BAC,57422BAC]
    ref=57422BE0[57422BE0,57422BE0] lnd=57422BEC[57422BEC,57422BEC]
    LIBRARY OBJECT: object=6a7276e4
    type=CRSR flags=EXS[0001] pflags=[0000] status=VALD load=0
    CHILDREN: size=16
    child# table reference handle
    0 66148018 66147e34 54e2b2d0
    1 66148018 5896c0ec 6af7d37c
    DATA BLOCKS:
    data# heap pointer status pins change whr
    0 696b76e0 6a72777c I/P/A/-/- 0 NONE 00
    SO: 5C78B970, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c78b970 handle=54fbd288 mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C78B9C0[5C787B90,5C59D1B0] htb=5C59D1B0 ssga=5C59CD04
    user=5f375f38 session=5f37d6a8 count=1 flags=[0000] savepoint=0x0
    LIBRARY OBJECT HANDLE: handle=54fbd288 mtx=54FBD33C(0) cdp=0
    namespace=CRSR flags=RON/KGHP/PN0/EXP/[10010100]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=0 latch#=3 hpc=f79a hlc=f79a
    lwt=54FBD2E4[54FBD2E4,54FBD2E4] ltm=54FBD2EC[54FBD2EC,54FBD2EC]
    pwt=54FBD2C8[54FBD2C8,54FBD2C8] ptm=54FBD2D0[54FBD2D0,54FBD2D0]
    ref=54FBD304[5BF92EF0,5BF92EF0] lnd=54FBD310[54FBD310,54FBD310]
    LIBRARY OBJECT: object=541e8b98
    type=CRSR flags=EXS[0001] pflags=[0000] status=VALD load=0
    DEPENDENCIES: count=1 size=16
    AUTHORIZATIONS: count=1 size=16 minimum entrysize=16
    ACCESSES: count=1 size=16
    TRANSLATIONS: count=1 size=16
    DATA BLOCKS:
    data# heap pointer status pins change whr
    0 693cb454 541e8c30 I/P/A/-/- 0 NONE 00
    6 5bf92e34 a021d62c I/-/A/-/E 0 NONE 00
    SO: 5C787B40, type: 53, owner: 5F375F38, flag: INIT/-/-/0x00
    LIBRARY OBJECT LOCK: lock=5c787b40 handle=5eb09aec mode=N
    call pin=00000000 session pin=00000000 hpc=0000 hlc=0000
    htl=5C787B90[5C59D1B0,5C78B9C0] htb=5C59D1B0 ssga=5C59CD04
    user=5f375f38 session=5f37d6a8 count=1 flags=[0000] savepoint=0x4bc41571
    LIBRARY OBJECT HANDLE: handle=5eb09aec mtx=5EB09BA0(2) cdp=2
    name=select o.owner#,o.name,o.namespace,o.remoteowner,o.linkname,o.subname,o.dataobj#,o.flags from obj$ o where o.obj#=:1
    hash=ae93e4a5100360375a3ff87632f4667e timestamp=04-02-2010 10:17:58
    namespace=CRSR flags=RON/KGHP/TIM/PN0/MED/KST/DBN/MTX/[500100d0]
    kkkk-dddd-llll=0000-0001-0001 lock=N pin=0 latch#=3 hpc=d23e hlc=d23e
    lwt=5EB09B48[5EB09B48,5EB09B48] ltm=5EB09B50[5EB09B50,5EB09B50]
    pwt=5EB09B2C[5EB09B2C,5EB09B2C] ptm=5EB09B34[5EB09B34,5EB09B34]
    ref=5EB09B68[5EB09B68,5EB09B68] lnd=5EB09B74[5EB09B74,5EB09B74]
    LIBRARY OBJECT: object=5bf92fd4
    type=CRSR flags=EXS[0001] pflags=[0000] status=VALD load=0
    CHILDREN: size=16
    child# table reference handle
    0 5bf92f60 5bf92d7c 5eb099a8
    1 5bf92f60 5bf92ef0 54fbd288
    2 5bf92f60 5b9aa120 576a80c8
    3 5bf92f60 5b9aa284 54f7a6d0
    DATA BLOCKS:
    data# heap pointer status pins change whr
    0 5eb09a7c 5bf9306c I/P/A/-/- 0 NONE 00

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

  • Inserts into Global Temporary Table

    I'm working on using a global temporary table in one of my apps. I have a small test run here to isolate the problem. It simply creates the global temporary table, inserts a row, commits and then does a select to see if the insert worked. No data shows in the table when running this. I don't know much about global temp tables, so any help would be appreciated.
    CREATE GLOBAL TEMPORARY TABLE AGENT_SILO.AS_TEMP_VALIDATE (
    SBI_EMPLOYEE_ID NUMBER,
    CURRENT_FLAG char(1),
    EFFECTIVE_START date,
    EFFECTIVE_END date
    ) ON COMMIT DELETE ROWS;
    INSERT INTO AGENT_SILO.AS_TEMP_VALIDATE(SBI_EMPLOYEE_ID, CURRENT_FLAG, EFFECTIVE_START, EFFECTIVE_END)
    VALUES(0, '', SYSDATE, SYSDATE);
    commit;
    SELECT * FROM AGENT_SILO.AS_TEMP_VALIDATE;

    So I wonder what else I'm doing wrong that's really obvious. Here's what i'm trying to accomplish and maybe there's a better way of going about it.
    I have a trigger that is supposed to do some validation before the insert is allowed to go through. So here's my approach. I have a trigger fired when there's an insert into the AS_Employee_history table. This passes some of the fields from this insert into a proc (the id, a flag and a couple of dates). Within the proc, i create a global temp table, insert these passed values into the temp table. Then I have a cursor to basically copy the rows from the as_employee_history table that have the same id. Then I can do some selects on the temp table to see if it passes the validation.
    I have outputs throughout for debugging and it gets to right after the inserts into the temp table, then the rest of the code doesn't appear to be executed. So it looks like it's failing at the execution of select statements on the temp table. Anything else obvious that I"m missing here?
    Here's my proc.
    PROCEDURE "PAS_VALIDATE" (STATUS OUT VARCHAR2, v_status OUT BOOLEAN, NEW_SBI_EMPLOYEE_ID IN NUMBER,
    NEW_CURRENT_FLAG IN CHAR, NEW_EFFECTIVE_START IN DATE,
    NEW_EFFECTIVE_END IN DATE)
    IS
    v_prev_effective_end date;
    v_flag_count number;
    v_flag_count_date number;
    --variables to store dynamic sql returns
    v_sql_flag_count_date varchar2(255);
    v_sql_flag_count varchar2(255);
    v_sql_prev_eff_end varchar2(255);
    cursor c_row is
    select * from AGENT_SILO.AS_EMPLOYEE_HISTORY EMP
    where (EMP.SBI_EMPLOYEE_ID = NEW_SBI_EMPLOYEE_ID);
    r_row c_row%ROWTYPE;
    BEGIN
    Status := 'Started';
    v_status := true;
    DBMS_OUTPUT.PUT_LINE('Creating temporary table...');
    execute immediate 'CREATE GLOBAL TEMPORARY TABLE AGENT_SILO.AS_TEMP_VALIDATE (
    SBI_EMPLOYEE_ID NUMBER,
    CURRENT_FLAG char(1),
    EFFECTIVE_START date,
    EFFECTIVE_END date
    ) ON COMMIT PRESERVE ROWS';
         DBMS_OUTPUT.PUT_LINE('Validating the data...');
         --DBMS_OUTPUT.PUT_LINE('Inserting submitted row into temp table');
    --Insert the new row being submitted from user into the temp table
    execute immediate 'INSERT INTO AGENT_SILO.AS_TEMP_VALIDATE(SBI_EMPLOYEE_ID, CURRENT_FLAG, EFFECTIVE_START, EFFECTIVE_END)
    VALUES(' || NEW_SBI_EMPLOYEE_ID || ',
    ''' || NEW_CURRENT_FLAG || ''',
    to_date(''' || to_char(NEW_EFFECTIVE_START, 'mm/dd/yyyy hh:mi:ss') || ''', ''mm/dd/yyyy hh:mi:ss''),
    to_date(''' || to_char(NEW_EFFECTIVE_END, 'mm/dd/yyyy hh:mi:ss') || ''', ''mm/dd/yyyy hh:mi:ss''))';
    --Insert the other rows to we end up with a subset of the employee history table
    --with only rows that match the sbi_employee_id of the submitted row
         --DBMS_OUTPUT.PUT_LINE('Inserting into temp table...');
    open c_row;
    loop
    fetch c_row into r_row;
    exit when c_row%NOTFOUND;
    execute immediate 'INSERT INTO AGENT_SILO.AS_TEMP_VALIDATE(SBI_EMPLOYEE_ID, CURRENT_FLAG, EFFECTIVE_START, EFFECTIVE_END)
    VALUES(' || r_row.SBI_EMPLOYEE_ID || ',
    ''' || r_row.CURRENT_FLAG || ''',
    to_date(''' || to_char(r_row.EFFECTIVE_START, 'mm/dd/yyyy hh:mi:ss') || ''', ''mm/dd/yyyy hh:mi:ss''),
    to_date(''' || to_char(r_row.EFFECTIVE_END, 'mm/dd/yyyy hh:mi:ss') || ''', ''mm/dd/yyyy hh:mi:ss''))';
    end loop;
    close c_row;
    DBMS_OUTPUT.PUT_LINE('After inserts');
    -----Store queries to determine values for validation--------------------------
    v_sql_prev_eff_end := 'SELECT to_char(max(effective_end), ''dd-mon-yy'')
    FROM AGENT_SILO.AS_TEMP_VALIDATE
    where to_char(EFFECTIVE_END, ''dd-mon-yy'') != ''31-dec-99'' AND
    SBI_EMPLOYEE_ID = NEW_SBI_EMPLOYEE_ID';
    --Find the largest effective_end, besides the 9999 value
    execute immediate v_sql_prev_eff_end into v_prev_effective_end;
    DBMS_OUTPUT.PUT_LINE('The highest previous end date: ' || v_prev_effective_end);
    --...........Validation testing...........
    execute immediate 'DROP TABLE AGENT_SILO.AS_TEMP_VALIDATE'; --Drop temp table
    DBMS_OUTPUT.PUT_LINE('Validation Procedure Complete');
    COMMIT;
    status:='Success';
    EXCEPTION
    When Others Then
    ROLLBACK;
    Status := SQLERRM;
    END;
    Thanks a bunch for helping a noob out.

  • 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

  • Windows 8.1 TPM ownership on Server 2008 R2 schema - not to spec?

    My organization is running AD DS on Server 2008 R2 schema. Already a bad start, I know, but let's pretend that's impossible to change. In our default domain policy, we have the following setting enabled to require AD backup of TPM owner authorization

  • How to correct the error message that appears when installing photoshop CS5 for the third time

    I need help so solve the error message that appears on my computer when I try to register the program for the third time. Please helpppppp!

  • Can't add comments

    I have been having issues with my adding comments part in the blog of my page. I publish to .mac, and have the add comments box checked prior to publishing. When I publish, immediately after, I or other computers can leave comments. After a little bi

  • HT3939 is there an update for iPhone 4 A1332?

    is there an update for iPhone 4 A1332? It seems lately every ap I try to load requires a different system.

  • Help in selecting last n records

    Hi All I have the following tables in my database CREATE TABLE MACHINE_M ( ID     VARCHAR(20)     NOT NULL, NAME     VARCHAR(20) CREATE TABLE STG_READING ( ID     VARCHAR(20)     NOT NULL, MACHINE_ID     VARCHAR(20), DATE_ID     NUMBER, TIME_ID NUMBE