Update Global Temp Table in Oracle 11g

Hi Experts,
Scenario: I have stored  procedure A which calls procedure B. Procedure B uses Global temp Tables(With On Commit Preserve Rows)  to work with the data.
I am trying to update one of the GTT in Proc B but unable to do it .. via SQL or via PL/SQL Cursor/Collection. There is no syntax nor logical error and the PL/SQL proc completes execution successfully but the rows are not getting updated. My Db version is Oralce 11g 11203.
Update statement is something like this.
Update <GTT>
SET amount1 = amount1 *-1, amount2 = amount2 *-1
where field1 = <value>
and field2 in ( Select filed2 from <table1> );
Any idea why would this update not work? Has anyone faced this issue in Oracle 11g??
Appreciate your suggestions & thanks in Advance for your inputs.
Cheers,
MS

Update statement is something like this.
Update <GTT>
SET amount1 = amount1 *-1, amount2 = amount2 *-1
where field1 = <value>
and field2 in ( Select filed2 from <table1> );
Any idea why would this update not work?
You already told us that it DOES work - no errors or exceptions.
It is trivial to determine if that update will do anything - just turn it into a SELECT and see if any rows are ntselected:
v_cnt INTEGER;
SELECT COUNT(*) INTO v_cnt FROM  myGTT
WHERE field1 = <value>
AND field2 in (Select field2 from <tablee1>);
Then take a look at the 'count' that you get.

Similar Messages

  • Global temp table in Oracle EBS

    hi gurus,
    i have a GTT with "ON COMMIT PRESERVE ROWS".
    i am populating this table through an OAF page and displaying the data.
    as per the documentation it should delete the data from the table once user logs out from the Oracle EBS but it's not happening.
    the user still sees the records from the previous session.
    please throw some light here.
    thanks,

    i was wondering if there is any sysadmin level setup/profile setup which can end the session (JDBC) once user logs out?No such profile option exists.
    Behavior of Global Temp Table in JDBC
    Behavior of Global Temp Table in JDBC
    Global temp tables with connection pooling
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4444273995237
    Make global temporary tables transaction specific
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:868691300346807468
    Thanks,
    Hussein

  • Global temp tables difference in oracle 10g and 11g

    Hi All,
    we are planning to upgrade metasolv applications from 6.0.15 (currently suing 10g) to 6.2.1(currently using 11g).We are using the Global temp tables in 10g .i just want to know is there any impact if we upgrade the Global temp tables from 10g to 11g.if so can u please explain me clearly ?
    Please and thanks.

    FAQ on new features: Re: 14. What's the difference between different versions of the database?
    This can be used as a reference for all your queries..

  • Is it possible to load and read from an Oracle global temp table?

    Is there a way to call an Oracle database package to pre-load global temp tables in BIP? I am an Oracle Reports user but a newbie to BIP. In Oracle Reports, I use the before-reports trigger to execute a database package that will populate a temp table with data. Then, in Oracle Reports, I read the temp table as the report data source. In BIP, I cannot find the ‘before-reports trigger’ equalivant. Since all the complicated business logic is contained in package it would be helpful to bring in the loaded temp table into BIP. Any thoughts?
    Example:
    Step 1. In the Oracle Reports before report trigger : exec db_package.load_temp_table_procedure (:var1, :var2, :var3);
    Step 2: Select * from temp_table.

    Look at Datatemplates,
    It has pre and post report trigger,
    You can do all these stuff over there,
    Calling a package  in Data template

  • Use of Oracle global temp table in BI Publisher

    Hi All,
    I have witten a function which populates a Gobal temp table.I call the function and do a select on the global temp table.This fails to give me any result.
    We are calling the function within the package in the 'beforeReport' trigger in our Data Template in BI Publisher.
    I tried to check the session id and found that the sessions are different when we execute the functiona and when we do a select query.
    How can I avoid this situation of changing session?
    I have tried by removing commit from the function but even thta didnt help.
    Please let me know if anyone has suugestion on this.
    Thanks in advance!

    Hi,
    To check if the function is working fine , we inserted the output from temp table into a normal physical table .We queried the physical table and found the values there.
    So , the function is working fine.
    We dont have any statement like 'PRAGMA AUTONOMOUS_TRANSACTION ' in our function.
    Do we need to add it?
    Just to clarify the issue , We have populated the temp table by calling a function and after that we are trying to query the temp table.However, it appears that the session changes between teh function call and issuing of select query .This is resultin into no data being fetched as the values in Gloabal temp table persist only for a session.
    Thanks!

  • Global temp table and edit

    Hi all,
    Can someone tell me why when I create a GTT and insert the data like the followijng ,I get insert 14 rows msg. But when I do a select statement from sqlwork shop , sometimes i get the data sometimes I don't. my understanding is this data is supposed to stay during my logon session then got cleaned out when I exit session.
    I am developing a screen in apex and will use this temp table for user to do some editing work. Once ithe editing is done then I save the data into a static table. Can this be done ? So far my every attempt to update the temp table always result to 0 rows updated and the temp table reversed back to 0 rows. CAn you help me ?
    CREATE GLOBAL TEMPORARY TABLE "EMP_SESSION"
    (     "EMPNO" NUMBER NOT NULL ENABLE,
         "ENAME" VARCHAR2(10),
         "JOB" VARCHAR2(9),
         "MGR" NUMBER,
         "HIREDATE" DATE,
         "SAL" NUMBER,
         "COMM" NUMBER,
         "DEPTNO" NUMBER
    ) ON COMMIT PRESERVE ROWS
    insert into emp_session( EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
    select * from emp
    select * from emp_session
    -- sometimes I get 14 rows, sometimes 0 rows
    Thanks.
    Tai

    Tai,
    To say that Apex doesn't support GTT's is not quite correct. In order to understand why it is not working for you and how they may be of use in an Apex application, you have to understand the concept of a session in Apex as opposed to a conventional database session.
    In a conventional database session, as when you are connected with sqlplus then you have what is known as a dedicated session, or a synchronous connection. Temporary objects such as GTTs and packaged variables can persist across calls to the database. A session in Apex however is asynchronous by nature and a connection to the database is done through some sort of a server such as the Oracle HTTP server or the Apex Listener, which in effect maintains a pool of connections to the database and calls by your application aren't guaranteed to get the same connection for each call.
    To get over this, the guys who developed Apex came up with various methods to maintain session state and global objects that are persistent within the context of an Apex session. One of these is Apex collections, which are a device for maintaining collection like (array like) data that is persistent within an Apex session. These are Apex session specific objects in that they are local to the session that creates and maintains them.
    With this knowledge, you can then see why the GTT is not working for you and also how a GTT may be of use in an Apex application, provided you don't expect the data to persist across a call, as in a PL/SQL procedure. You should note though, that unless you are dealing with very large datasets, then a regular Oracle collection is preferable.
    I hope this explains your issue.
    Regards
    Andre

  • Global Temp Table or PL/SQL Table

    I am trying to determine if this can be done only using PL/SQL table. If not, will the usage of the global temp table affects the performance.
    Here is the situation,
    I have a data block that is based on a stored procedure. This stored procedure will return table of records from different database tables with join conditions. Some of the fields within the table of records will not have data returned from database tables. They will be the fields displayed on the form and the data will be entered by user.
    For example:
    Records will look like:
    Id          (will be populated by procedure)
    Hist_avg     (will be populated by procedure)
    My_avg     (will be used as field on the form so that user can enter their own avg)
    Cheked     (will be populated by procedure)
    My questions are:
    1.     Is this doable in form using a data block based on PL/SQL table?
    2.     Will users be able to manipulate (update) the data that based on the PL/SQL table in the memory as they wish and invoke the procedure to update the underlying table when clicking on a button (Update Avg)?
    3.     What is the advantage of using PL/SQL table and global temp table from database and form point of views?
    Any info is appreciated.

    Hi there...
    Here is the Reference...
    http://asktom.oracle.com/pls/ask/f?p=4950:8:2939484874961025998::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:604830985638
    Best Regards...
    Muhammad Waseem Haroon

  • Can a tabular form be created/used against a GLOBAL TEMP TABLE?

    We are trying to simplify our apex applications. In doing so, we are examing the many collections we use to create tablular forms. These collections currently are tricky to manage and we are considering moving them to either VIEWS or GLOBAL TEMPORARY TABLES (GTT).
    I have created a test app against a GLOBAL TEMP TABLE....it looks great, but when I add a row and SUBMIT I recieve a message indicating record is inserted....but where did it go? I am unable to retrieve...I cannot see it in the underlying GLOBAL TEMP TABLE (as expected)....
    should I be creating an ON INSERT table on the GTT to automatically insert the data into a regular table?

    Now you know why you have to use collections :) Answered here:
    working with global temp table and apex
    Has to do with the session management and how APEX handles it.
    Create a view on your collection using the column names from the source table. Use packages to write an update, delete and insert process. This can be written automatically if there are multiple collections to handle.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • 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

  • Multiple users accessing the same data in a global temp table

    I have a global temp table (GTT) defined with 'on commit preserve rows'. This table is accessed via a web page using ASP.NET. The application was designed so that every one that accessed the web page could only see their data in the GTT.
    We have just realized that the GTT doesn't appear to be empty as new web users use the application. I believe it has something to do with how ASP is connecting to the database. I only see one entry in the V$SESSION view even when multiple users are using the web page. I believe this single V$SESSION entry is causing only one GTT to be available at a time. Each user is inserting into / selecting out of the same GTT and their results are wrong.
    I'm the back end Oracle developer at this place and I'm having difficulty translating this issue to the front end ASP team. When this web page is accessed, I need it to start a new session, not reuse an existing session. I want to keep the same connection, but just start a new session... Now I'm losing it.. Like I said, I'm the back end guy and all this web/connection/pooling front end stuff is magic to me.
    The GTT isn't going to work unless we get new sessions. How do we do this?
    Thanks!

    DGS wrote:
    I have a global temp table (GTT) defined with 'on commit preserve rows'. This table is accessed via a web page using ASP.NET. The application was designed so that every one that accessed the web page could only see their data in the GTT.
    We have just realized that the GTT doesn't appear to be empty as new web users use the application. I believe it has something to do with how ASP is connecting to the database. I only see one entry in the V$SESSION view even when multiple users are using the web page. I believe this single V$SESSION entry is causing only one GTT to be available at a time. Each user is inserting into / selecting out of the same GTT and their results are wrong.
    I'm the back end Oracle developer at this place and I'm having difficulty translating this issue to the front end ASP team. When this web page is accessed, I need it to start a new session, not reuse an existing session. I want to keep the same connection, but just start a new session... Now I'm losing it.. Like I said, I'm the back end guy and all this web/connection/pooling front end stuff is magic to me.
    The GTT isn't going to work unless we get new sessions. How do we do this?
    Thanks!You may want to try changing your GTT to 'ON COMMIT DELETE ROWS' and have the .Net app use a transaction object.
    We had a similar problem and I found help in the following thread:
    Re: Global temp table problem w/ODP?
    All the best.

  • Global Temp Table, always return  zero records

    I call the procedure which uses glbal temp Table, after executing the Proc which populates the Global temp table, i then run select query retrieve the result, but it alway return zero record. I am using transaction in order to avoid deletion of records in global temp table.
    whereas if i do the same thing in SQL navigator, it works
    Cn.ConnectionString = Constr
    Cn.Open()
    If FGC Is Nothing Then
    Multiple = True
    'Search by desc
    'packaging.pkg_msds.processavfg(null, ActiveInActive, BrandCode, Desc, Itemtype)
    SQL = "BEGIN packaging.pkg_msds.processavfg(null,'" & _
    ActiveInActive & "','" & _
    BrandCode & "','" & _
    Desc & "','" & _
    Itemtype & "'); end;"
    'Here it will return multiple FGC
    'need to combine them
    Else
    'search by FGC
    SQL = "BEGIN packaging.pkg_msds.processavfg('" & FGC & "','" & _
    ActiveInActive & "','" & _
    BrandCode & "',null,null); end;"
    'will alway return one FGC
    End If
    ' SQL = " DECLARE BEGIN rguo.pkg_msds.processAvedaFG('" & FGC & "'); end;"
    Stepp = 1
    Cmd.Connection = Cn
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Dim Trans As System.Data.OracleClient.OracleTransaction
    Trans = Cn.BeginTransaction()
    Cmd.Transaction = Trans
    Dim Cnt As Integer
    Cnt = Cmd.ExecuteNonQuery
    'SQL = "SELECT rguo.pkg_msds.getPDSFGMass FROM dual"
    SQL = "select * from packaging.aveda_mass_XML"
    Cmd.CommandType = Data.CommandType.Text
    Cmd.CommandText = SQL
    Adp.SelectCommand = Cmd
    Stepp = 2
    Adp.Fill(Ds)
    If Ds.Tables(0).Rows.Count = 0 Then
    blError = True
    BlComposeXml = True
    Throw New Exception("No Record found for FGC(Finished Good Code=)" & FGC)
    End If
    'First Row, First Column contains Data as XML
    Stepp = 0
    Trans.Commit()

    Hi,
    This forum is for Oracle's Data Provider and you're using Microsoft's, but I was curious so I went ahead and tried it. It works fine for me. Here's the complete code I used, could you point out what are you doing differently?
    Cheers,
    Greg
    create global temporary table abc_tab(col1 varchar2(10));
    create or replace procedure ins_abc_tab(v1 varchar2) as
    begin
    insert into abc_tab values(v1);
    end;
    using System;
    using System.Data;
    using System.Data.OracleClient;
    class Program
        static void Main(string[] args)
            OracleConnection con = new OracleConnection("data source=orcl;user id=scott;password=tiger");
            con.Open();
            OracleTransaction txn = con.BeginTransaction();
            OracleCommand cmd = new OracleCommand("begin ins_abc_tab('foo');end;", con);
            cmd.Transaction = txn;
            cmd.ExecuteNonQuery();
            cmd.CommandText = "select * from abc_tab";
            OracleDataAdapter da = new OracleDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            Console.WriteLine("rows found: {0}", ds.Tables[0].Rows.Count);
            // commit, cleanup, etc ommitted for clarity
    }

  • Global temp table problem w/ODP?

    I'm using the current version of the ODP .NET data adapter to access a global temporary table on an Oracle
    9.2.0.4.0 server created with -
    CREATE GLOBAL TEMPORARY TABLE euik_dex_open_tasks_temp1
    (resource_id NUMBER,
    task_assignment_id NUMBER,
    task_id NUMBER,
    incident_id NUMBER,
    customer_product_id NUMBER,
    inventory_item_id NUMBER,
    contract_service_id NUMBER)
    ON COMMIT DELETE ROWS
    (See below for what is returned from the data dictionary for this table)
    If I use SQLPlus to insert a row into this table, then query the table immediately, I see the inserted row.
    If I use the same exact SQL through the ODP adapter, the ExecuteNonQuery statement returns the fact the 1 row was inserted. However, doing a SELECT from the table immediately after the INSERT, no rows are returned. See the .NET test ap, below.
    Also, note that if I use a global temp table made with ON COMMIT PRESERVE ROWS, the ODP adapter works fine.
    What am I doing wrong? Thanks in advance...
    Pat
    Private Sub TestTempTable()
    Dim Str1 As New System.Text.StringBuilder
    Dim Strx As New System.Text.StringBuilder
    Dim StrOut As New System.Text.StringBuilder
    Dim nInsert As Integer
    Dim nRow As Integer
    'Insert into the global temp table
    Str1.Append("INSERT INTO euik_dex_open_tasks_temp1(resource_id, " & vbCrLf)
    Str1.Append("      task_Assignment_id, " & vbCrLf)
    Str1.Append("     task_id, " & vbCrLf)
    Str1.Append("     incident_id, " & vbCrLf)
    Str1.Append("     customer_product_id, " & vbCrLf)
    Str1.Append("     inventory_item_id, " & vbCrLf)
    Str1.Append("     contract_service_id) " & vbCrLf)
    Str1.Append(" VALUES(1,2,3,4,5,6,7)" & vbCrLf)
    Dim cn As New Oracle.DataAccess.Client.OracleConnection
    Dim dr As Oracle.DataAccess.Client.OracleDataReader
    Dim cd As New Oracle.DataAccess.Client.OracleCommand
    Try
    cn.ConnectionString = "Data Source=XXX;User ID=mickey;Password=mouse;"
    cd.CommandType = CommandType.Text
    cd.Connection = cn
    cn.Open()
    'Run the query to load data in the temp table
    cd.CommandText = Str1.ToString()
    nInsert = cd.ExecuteNonQuery()
    MessageBox.Show(nInsert & " row(s) inserted.")
    'See if there are rows in the temp table
    Strx.Append("Select * from euik_dex_open_tasks_temp1")
    cd.CommandText = Strx.ToString()
    dr = cd.ExecuteReader
    nRow = 0
    While dr.Read
    StrOut.Append(dr(0) & vbCrLf)
    nRow = nRow + 1
    End While
    MessageBox.Show(nRow & " row(s) selected.")
    Catch ex As OracleClient.OracleException
    MessageBox.Show(ex.Message)
    Catch ex As Exception
    MessageBox.Show(ex.Message)
    Finally
    cn.Close()
    End Try
    End Sub
    OWNER     TABLE_NAME     TABLESPACE_NAME     CLUSTER_NAME     IOT_NAME     PCT_FREE     PCT_USED     
    INI_TRANS     MAX_TRANS     INITIAL_EXTENT     NEXT_EXTENT     MIN_EXTENTS     MAX_EXTENTS     PCT_INCREASE     
    FREELISTS     FREELIST_GROUPS     LOGGING     BACKED_UP     NUM_ROWS     BLOCKS     EMPTY_BLOCKS     AVG_SPACE     
    CHAIN_CNT     AVG_ROW_LEN     AVG_SPACE_FREELIST_BLOCKS     NUM_FREELIST_BLOCKS     DEGREE     INSTANCES     
    CACHE     TABLE_LOCK     SAMPLE_SIZE     LAST_ANALYZED     PARTITIONED     IOT_TYPE     TEMPORARY     
    SECONDARY     NESTED     BUFFER_POOL     ROW_MOVEMENT     GLOBAL_STATS     USER_STATS     DURATION     
    SKIP_CORRUPT     MONITORING     CLUSTER_OWNER     DEPENDENCIES     COMPRESSION
    APPS     EUIK_DEX_OPEN_TASKS_TEMP1                    10     40     1     255               
                   1     1     NO     N                                        
         1     1     N     ENABLED               NO          Y     N     NO     
    DEFAULT     DISABLED     NO     NO     SYS$TRANSACTION     DISABLED     NO          DISABLED     
    DISABLED

    Andrew,
    As David indicated if you do not wish to have "auto commit mode" you just need to use a transaction object to manually control the transaction.
    I'm just nervous at the idea of ODP.NET initiating interactions I am not aware of.I think it would be more fair to say "finishing interactions" in this case rather than "initiating interactions" but you could always just run a SQL trace from the database to see exactly what is happening if you are concerned.
    HTH,
    - Mark
    =======================================
    Mark A. Williams
    Oracle DBA
    Author, Professional .NET Oracle Programming
    http://www.apress.com/book/bookDisplay.html?bID=378

  • Error while creating Global temp table

    Hi,
    I am very new to PL/SQL so please excuse my question. I have the below query . I have to get a count between the source table and various target tables. I am creating a global temp table to store the counts. I am getting the below error for my following query :
    Thanks for the help,
    Petronas
    ----Query----
    set serveroutput on
    Declare
    nm1 varchar2(200);
    nm2 varchar2(200);
    cnt1 number;
    cnt2 number;
    diff number;
    totdiff number;
    Begin
    nm1 := null;
    nm2:= null;
    cnt1:= 0;
    cnt2 := 0;
    diff := 0;
    totdiff := 0;
    create GLOBAL TEMPORARY TABLE diff ( name1 varchar(200), name2 varchar2(200), diff number);
    select count(*) into cnt1
    from users_staging;
    select count(*) into cnt2
    from PROD.users;
    nm1 := 'users_staging';
    nm2 := 'PROD.users';
    diff := cnt1 - cnt2;
    insert into diff values (nm1,nm2,diff);
    select count(*) into totdiff
    from diff
    where diff> 0 ;
    dbms_output.enable(10000);
    dbms_output.put_line('# of tables where difference is > 0 ' ||totdiff);
    end;
    Encountered the symbol "CREATE" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-identifier>
    <a bind variable> << close current delete fetch lock insert
    open rollback savepoint set sql execute commit forall merge
    pipe

    Hi,
    "CREATE GLOBAL TEPORARY TABLE ..." is not a PL/SQL command; it is a SQL command only.
    Create the table, using that statement, before running the PL/SQL block.
    You can issue SQL statements from within PL/SQL using the EXECUTE IMMEDIATE command, but this is rarely a good idea.
    I assume the PL/SQL code is meant to create the table and then populate it.
    You should split those into two separate pieces of code. You'll only want to create the table once, no matter how many times you use it. I assume you'll want to populate it the same way many times. Remember, the "TEMPORARY" in "GLOBAL TEMPORARY TABLE" refers to the data, not the table. When you end a transaction (or a session, depending on whther you want "ON COMMIT DELETE ROWS" or "ON COMMIT PRESERVE ROWS"), the data disappears, but the now-empty stays, ready to be populated for the next transaction (or session).
    Edited by: Frank Kulash on Aug 4, 2010 2:25 PM

  • Use global temp table for DML error logging

    our database is 11.2.0.4 enterprise edition on solaris 10
    we are wondering if anyone has an opinion of or has done this before, to use a global temp table for DML error logging. We have a fairly busy transactional database with 2 hot tables for inserts. The regular error table created with dbms_errlog has caused many deadlocks which we don't quite understand yet. we have thought using global temp table for the purpose, and that seemed to work, but we can't read error from the GTT, the table is empty even reading from the same session as inserts. Does anyone have an idea why?
    Thanks

    The insert into the error logging table is done with a recursive transaction therefore it's private from your session which is doing the actual insert.
    Adapted from http://oracle-base.com/articles/10g/dml-error-logging-10gr2.php
    INSERT INTO dest
    SELECT *
    FROM  source
    LOG ERRORS INTO err$_dest ('INSERT') REJECT LIMIT UNLIMITED;
    99,998 rows inserted.
    select count(*) from dest;
      COUNT(*)
        99998
    SELECT *
    FROM  err$_dest
    WHERE  ora_err_tag$ = 'INSERT';
    1400    "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")"        I    INSERT    1000        Description for 1000
    1400    "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")"        I    INSERT    10000        Description for 10000
    1400    "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")"        I    INSERT    1000        Description for 1000
    1400    "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")"        I    INSERT    10000        Description for 10000
    rollback;
    select count(*) from dest;
      COUNT(*)
            0
    SELECT *
    FROM  err$_dest
    WHERE  ora_err_tag$ = 'INSERT';
    1400    "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")"        I    INSERT    1000        Description for 1000
    1400    "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")"        I    INSERT    10000        Description for 10000
    1400    "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")"        I    INSERT    1000        Description for 1000
    1400    "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")"        I    INSERT    10000        Description for 10000

  • Global Temp Tables

    Has anyone had any luck using global temp tables within DI?  I am tryng to create a process that will populate a global tmp table in one data flow and then read from that global tmp table in the next data flow within the same work flow.  A template table won't work for my needs as I also need to be able to do a lookup_ext... is null from this table as well.
    There is a risk in using a physical temp table as this process will be ran many times through out the day with various values.
    Thanks,
    Alicia

    Within Oracle one can create a Global Temporary Table which is a database object; however, it clears it's contents when the session is released.  It is useful when creating reusable routines as multiple processes can write different information to the table and the table maintains the information for the life of the SQL session.  For instance one can populate the table with a list of codes to be used in a SQL statement for a product and run a seperate process simutaneously populating codes for a different product.
    The probelm I am having right now is that DI seems to be closing it's SQL session before it goes to the Data Flow that needs the code list.
    Thanks,
    Alicia

Maybe you are looking for

  • How to access the webservice in portal component

    hai      how to access the webservice in portal component.      anyone knows give the solution Rds Shanthakumar

  • How do I know the source of 0DOC_CATEG in a report since mapped from 3 diff

    Hi, How do I know the source of 0DOC_CATEG in a report since mapped from 3 different sources I have in report a 2 chars, 0DOC_CATEG and 0DOC_TYPE which are in a dimension Dim1 in the multiprovider Mult1. In the Identification for the multiprovider, i

  • Consolidation of items in accounting document

    Hi All I have this scenario in MySAP ERP 2005 version SD Billing doc has two line items Item 1{Material=A,Plant=2000,P-centre=21000,Amount=$3,Qty=1,Tax=$0.42} Item 2{Material=A,Plant=2000,P-centre=21000,Amount=$4,Qty=1,Tax=$0.56} Revenue was posted t

  • Enabling Automatic Check In of Originals in DMS

    Can anyone help me get this working in DMS? When creating the DIR from CV01N I would like the original to be automatically checked in. It looks like there is a setting in the status to do this but I can't get it working. It looks like it depends on t

  • Gamma shift when exporting MP4

    I know this is a known issue, but I have yet to see a viable solution. Working off PC and exporting via Adobe encoder. When exporting H.264 in an mp4 container, there are significant gamma shift issues that void several hours/days of color correction