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

Similar Messages

  • When to use global temporary tables?

    which are the probable situations when one can think of using global temporary tables?

    In my experience, most often GTTs are used by developers from other RDBMSs who have become used to needing 'intermediate tables' created on the fly to hold data while they 'loop and commit to free locks'.
    These developer may not have had enough exposure to Oracle's concurrency model and therefore use the 'other' concurrency model as the basis for an application port - usually followed up by a call to the forum for assistance in performance tuning. <g>
    That said, legitimate uses for GTTs include staging or scrubbing table for data transport or preparation, eg: ETL into a warehouse, when the intermediate data is
    a) reproducible (therefore does not need to be logged); and
    b) the results of the intermediate operation, but not the source, are stored in permanent tables.
    Some developers also use GTTs to hold the equivalent to a 'temporary materialized view' specifically for complex reporting purposes.

  • 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

  • Using Global Temporary Table in OBIEE 11

    Hi,
    THe requirement is to run a database function before the report runs. This Function accepts 5 parameters (Presentation Variable) and populates a GTT Global Temporary Table.
    This GTT is configured in presentation Layer.
    Issue:
    1. Created a dummy report which returns only one row and called the fucntion using "Evaluate" in this.
    2. Created 2nd report using GTT Columns.
    All these 2 reports placed on dashboard and Presentation variable are set in the prompt. The first one runs correctly and populate the "Regular Table". Means when I create a regular table instead of GTT I can see the correct record. But if I change it to GTT then the data does not get populated in this table.
    Any Inputs?
    Regards

    HI,
    If you are using a GTT, you need to run the function which populates the GTT before OBI server executes the select query on that table.
    In your case, the OBI server is executing the select query from the table before the data is populated in the table.
    In order to force the BI server to run the query after the GTT is populated, you need to specify the condition in the connection pool settings under the connection scripts tab.
    In the execute before query, enter your physical query which runs the function to populate the GTT.
    Hope this helps !
    Thanks,
    Vineeth

  • Problem ! Calling report6 from forms6(run_product()) using global temporary table.

    Requirement :
    To generate stock movement report for certain selected items.
    Background :
    A Form is created with data block (tmp_item_master - a global temporary table)
    when_new_form_instance :
    inserting into tmp_item_master from item_master and then execute_query on tmp_item_master block.
    User selects certain items using check box provided.
    Now tmp_item_master is updated for ch_select_flag_yn = 'Y' for selected items
    and commit.
    Calling report from form(using run_product()).
    Now the main query in report, is joined with tmp_item_master where ch_select_flag_yn = 'Y'
    Here, we are unable to see the report for any item. As the global temporary table data is not visible in the report session.
    How to resolve this problem ?
    Note : global temporary table created with ON COMMIT PRESERVE ROWS
    Thanking you,
    From praful.
    null

    Hi,
    You are using 'ON Commit Delete Rows' . Instead of Use ' ON COMMIT PRESERVE ROWS'
    The ON COMMIT DELETE ROWS clause indicates that the data should be deleted at the end of the transaction.
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
    column1 NUMBER,
    column2 NUMBER
    ) ON COMMIT DELETE ROWS;
    In contrast, the ON COMMIT PRESERVE ROWS clause indicates that rows should be preserved until the end of the session.
    CREATE GLOBAL TEMPORARY TABLE my_temp_table (
    column1 NUMBER,
    column2 NUMBER
    ) ON COMMIT PRESERVE ROWS;
    Edited by: Mrucha on Nov 26, 2012 6:06 AM

  • Using Global Temporary Table in Discoverer.

    Hi All
    I am currently working on a Disco report, where I am initializing a package at the disco condition level which inserts data in to a Global Temporary Table.
    The global temporary table will be having data based on the parameter entered by the user. But the problem occurs when we are trying to use the same GTT in the select statement as shown below. The desktop is not giving me the otuput but the GTT is getting populated with data.
    see below
    SELECT bla1,
    bla2,
    bla3
    FROM GTT (global temp table)
    WHERE 1= PACKAGE.FUNCTION(par1, par2, par3...) <- here we are trying to insert into GTT based on the paramenters passed.
    Can you please suggest how this can be achieved. Or is there any way to trigger the insertion in to GTT other than the calling it in the condition level.
    Thanks
    Arun

    Hi,
    You cannot use a GTT like this because you cannot write and read from the GTT using a single SQL statement. You must either have the insert in a separate worksheet and tell the users to run this worksheet first, or you wrap it all up in a table function called from within a view. The table function can then insert and select from the GTT using two statements.
    Which method is best depends on what you are trying to do and why you want to use a GTT.
    Rod West

  • Hi, i am getting an error while using the External Table.

    Hi,
    I am getting the below error. External table has been created successfully and when I read the data from the external table i get the below error. Can anyone give solution of this error.
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: unable to open log file EXT_ZPP0A871_6738.log
    OS error Permission denied
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    Thanks,
    Himanshu

    KUP-04063: unable to open log file EXT_ZPP0A871_6738.log
    OS error Permission deniedThe error seems quite clear... what's you OS and Oracle version ?

  • Use of global temporary tables in Procedures

    Hi
    I am using global temporary tables in the procedures. Loading data in the same table through many procedures. I am fetching the data from the global temporary table in PRO-C by a cursor. Will this degrade performance?
    Please help me..
    Thanks in Advance...

    Will this degrade performance?That depends... in comparison to what?
    Loading data into temporary tables will generally be more efficient than loading data into permanent tables because Oracle needs to do less to protect this data since it is inherently transient. On the other hand, loading the data into a table in the first place tends to be more expensive than alternatives like using a single SQL statement, a pipelined table function, or an in memory collection.
    Justin

  • Will Partitioning improve performance on Global Temporary Table

    Dear Guru,
    In one of complicated module I am using Global Temporary Table (GTT) for intermediate processing i.e. It will store required data in it but the rows of the data goes into 10,00,000 - 20,00,000.
    Can Partitioning or Indexing on Global Temporary Table improve the performance?
    Thanking in Advance
    Sanjeev

    Sounds like an odd use of a GTT to me, but I'm sure there are valid reasons...
    Presumably you are going to be processing all of these rows in some way? In which case I can't see how partitioning, even if it's possible (And I don't think it is) would help you.
    Indexes - sure, that might help, but again, if you are reading all/most of these rows anyway they might not help or even get used.
    Can you give a bit more detail about exactly what you are doing?
    Edited by: Carlovski on Nov 24, 2010 12:51 PM

  • Error while creating the DWH tables using DAC

    Hi,
    I am getting error while creating the DWH tables using DAC. I have created a ODBC DSN using merant driver with DAC repository DB credentials and the test connection is successful. And while creating the tables i gave the olap dw credentials and the DSN name which i created earlier. But it throws the error as below:
    Please find the below mentioned error message
    =====================================
    STD OUTPUT
    =====================================
    CREATING SIEBEL DATABASE OBJECTS
    F:\DAC\bifoundation\dac\UTILITIES\BIN\DDLIMP /I N /s N /u infdomain /p ******* /c DB_DAC /G "SSE_ROLE" /f F:\DAC\bifoundation\dac/conf/sqlgen/ctl-file/oracle_bi_dw.ctl /b "" /K "" /X "" /W N
    Error while importing Siebel database schema.
    =====================================
    ERROR OUTPUT
    =====================================
    Siebel Enterprise Applications ODBC DDL Import Utility, Version 7.7 [18030] ENU
    Copyright (c) 2001 Siebel Systems, Inc. All rights reserved.
    This software is the property of Siebel Systems, Inc., 2207 Bridgepointe Parkway,
    San Mateo, CA 94404.
    User agrees that any use of this software is governed by: (1) the applicable
    user limitations and other terms and conditions of the license agreement which
    has been entered into with Siebel Systems or its authorized distributors; and
    (2) the proprietary and restricted rights notices included in this software.
    WARNING: THIS COMPUTER PROGRAM IS PROTECTED BY U.S. AND INTERNATIONAL LAW.
    UNAUTHORIZED REPRODUCTION, DISTRIBUTION OR USE OF THIS PROGRAM, OR ANY PORTION
    OF IT, MAY RESULT IN SEVERE CIVIL AND CRIMINAL PENALTIES, AND WILL BE
    PROSECUTED TO THE MAXIMUM EXTENT POSSIBLE UNDER THE LAW.
    If you have received this software in error, please notify Siebel Systems
    immediately at (650) 295-5000.
    F:\DAC\bifoundation\dac\UTILITIES\BIN\DDLIMP /I N /s N /u infdomain /p ***** /c DB_DAC /G SSE_ROLE /f F:\DAC\bifoundation\dac/conf/sqlgen/ctl-file/oracle_bi_dw.ctl /b /K /X /W N
    Connecting to the database...
    28000: [DataDirect][ODBC Oracle driver][Oracle]ORA-01017: invalid username/password; logon denied
    Unable to connect to the database...
    any help is appreciated.
    Thanks,
    RM

    The fact that you are getting an "ORA-01017: invalid username/password; logon denied" message indicates that you are at least talking to the database.
    The log shows that username "infdomain" is being used. Can you double check the username and password you have in DAC in a SQL*Plus/SQL Developer session?
    Please mark if useful/helpful,
    Andy.

  • 3-1674105521 Multiple Paths error while using Bridge Table

    https://support.us.oracle.com/oip/faces/secure/srm/srview/SRViewStandalone.jspx?sr=3-1674105521
    Customer Smiths Medical International Limited
    Description: Multiple Paths error while using Bridge Table
    1. I have a urgent customer encounterd a design issue and customer was trying to add 3 logical joins between SDI_GPOUP_MEMBERSHIP and these 3 tables (FACT_HOSPITAL_FINANCE_DTLS, FACT_HOSPITAL_BEDS_UTILZN and FACT_HOSPITAL_ATRIBUTES)
    2. They found found out by adding these 3 joins, they ended with circular error.
    [nQSError: 15001] Could not load navigation space for subject area GXODS.
    [nQSError: 15009] Multiple paths exist to table DIM_SDI_CUSTOMER_DEMOGRAPHICS. Circular logical schemas are not supported.
    In response to this circular error, the developer was able to bypass the error using aliases, but this is not desired by client.
    3. They want to know how to avoid this error totally without using alias table and suggest a way to resolve the circular join(Multiple Path) error.
    Appreciated if someone can give some pointer or suggestion as the customer is in stiff deadline.
    Thanks
    Teik

    The strange thing compared to your output is that I get an error when I have table prefix in the query block:
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** DUMPFILE=TMP1.dmp LOGFILE=imp.log PARALLEL=8 QUERY=SYSADM.TMP1:"WHERE TMP1.A = 2" REMAP_TABLE=SYSADM.TMP1:TMP3 CONTENT=DATA_ONLY
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    ORA-31693: Table data object "SYSADM"."TMP3" failed to load/unload and is being skipped due to error:
    ORA-38500: Unsupported operation: Oracle XML DB not present
    Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 1 error(s) at Fri Dec 13 10:39:11 2013 elapsed 0 00:00:03
    And if I remove it, it works:
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
    Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** DUMPFILE=TMP1.dmp LOGFILE=imp.log PARALLEL=8 QUERY=SYSADM.TMP1:"WHERE A = 2" REMAP_TABLE=SYSADM.TMP1:TMP3 CONTENT=DATA_ONLY
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    . . imported "SYSADM"."TMP3"                             5.406 KB       1 out of 2 rows
    Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Fri Dec 13 10:36:50 2013 elapsed 0 00:00:01
    Nicolas.
    PS: as you can see, I'm on 11.2.0.4, I do not have 11.2.0.1 that you seem to use.

  • 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

  • Best to use in terms of tuning Global Temporary table or PLSQL Table type

    Hi All,
    which one is best to use in terms of tuning Global Temporary table or PLSQL table type?
    Thanks in Advance.
    Regards
    Deepika

    user8828028 wrote:
    which one is best to use in terms of tuning Global Temporary table or PLSQL table type?The answer to which one is better depends on the requirements - and an informed decision as to which one to use to address those requirements.
    Thus it is important to understand how these work. They are nothing alike.
    PL/SQL collections reside in the PGA. Can only be used in SQL via binding. Cannot be indexed. Temp tables on the other hand does not use expensive PGA. Does not need to be bind in SQL. Can be indexed. Etc.
    Sure, a (surgical) saw and scalpel are both used on the operating table - but for very different purposes.

  • 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

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

Maybe you are looking for

  • How to connect a Apple LED Cinema Display (24") to a PC with an ATI 4850?

    Help!!!! I have a new MacBook Pro and the LED Display just rocks with it, but my PC... how do I connect this MASSIVE investment to my PC with an ATI 4850?

  • 2 ALVs in a single view

    How to use 2 ALVs in a Single view. I need to take refernce of them individually, so that i can confgure them, independant of each other Thanks, Selvakumar M.

  • Installing CS6 upgrade on CS5.0 ???

    Hi I have just purchased a CS6 design & web premium upgrade and I have a CS5.0 design premium. I have downloaded and tried to install the upgrade but it seems that it needs CS5.5 version to install. I have looked for an update download that can make

  • Alarms ISE

    Hello We have a many alarms notifications you'll find the notification message on attached files Thanks

  • OutofMemoryError - Please Help

    Hello, I am using an ArrayList with a huge volume of data. Each element is an array with a String, 10 int values & 10 double values. I get "OutOfMemoryError" even though I have set -Xms10m -Xmx512m as runtime parameters. I even tried breaking the arr