Note that there are some explanatory texts on larger screens.

plurals
  1. POOracle 10g - Insert in to Temporary Table - Record count mismatch between select and insert
    primarykey
    data
    text
    <p>We are trying insert records from a select query in to temporary table, some of the records is missing in the temporary table. The select statement is having multiple joins and union all which it little complex query. In simple terms the script contains 2 part 1st Part Insert in to temporary table 2nd part Select query with multiple joins, inline sub queries, unions and group by classes and conditions</p> <p>Eg. If we execute select statement alone it returns some count for example => 60000 After inserting into the temp table, in temp table the count is around 42000 why is the difference?</p> <p><strong>Also, we have some other observation. It only happens in its 2nd execution and not its first run. Hope there might be some cache problem</strong></p> <hr> <p>We got a solution, once we clear session cache (checkpoint, flush shared_pool and buffer_cache) it works fine for Re_Run. </p> <h2>However, we do not know is this solution ok? and how clearing cache works in the background and failed insert. If it is true, something wrong configuration setup, i guess.</h2> <p>The code looks like sql = "insert in to temptable select x,y,z,.... from xxx,abc,pqr..where...."; (logial but not real is very complex around 700 lines with multiple joins, inline sub queries, group by etc. ) stmt = conn.createStatement(); rCount= stmt.executeUpdate(sql); <strong>Actual issue is rCount = xxxx = Count(temptable) &lt; count(select x,y,z,.... from xxx,abc,pqr..where....)</strong> why this diffference ? some records populated in the select but not inserted in to temp table</p> <p>Anyone can explain?</p> <p>thank you in advance for your efforts and help.</p> <p>Shiva.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload