Error on mapping: ORA-01002

Hi all,
When i try to insert data from an Informix database into Oracle the mapping crashes with the error ora-01002 after 50 rows (the number of rows has some relation to Bulk Size, because when it grows the error occurs in a later row).
I can insert the data into the table using the same connection that OWB using SQL*Plus.
what can be the problem?
I'm using OWB 9.2.
thanks,
Vitor

Hi,
The error that i've got on Runtime Audit Browser is "ORA-01002: fetch out of sequence ORA-02063: preceding line HSODBC@CON_STAGING_TO_INFORMIX". (HSODBC@CON_STAGING_TO_INFORMIX is the DB Link Created by OWB)
Answering to Mahesh, no, i can't use the Loading Type "INSERT/UPDATE" on the same table, because the fields are not the same, the INSERT has more fields then UPDATE.
Thanks,
Vitor

Similar Messages

  • Help - I'm getting errors ORA-06502:and ORA-01002: at runtime

    Help
    I am getting the following errors at runtime and need some isdeas on what to check:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "OWB_RUNTIME.WB_RT_MAPAUDIT", line 1736
    ORA-06512: at "OWB_RUNTIME.WB_RT_MAPAUDIT", line 2625
    ORA-06512: at "OWB_TARGET.MAP_BSL_PLACEMENT_FACT2B", line 1148
    ORA-01002: fetch out of sequence
    ORA-02063: preceding line from BASIL@LOC_TARGET_NEW_LOC_BASIL_SOURC
    ORA-06512: at "OWB_TARGET.MAP_BSL_PLACEMENT_FACT2B", line 1457
    ORA-06512: at "OWB_TARGET.MAP_BSL_PLACEMENT_FACT2B", line 3458
    ORA-06512: at line 1
    My Mapping is a fact recording enrolments in courses (located in my main target database - oracle 9i)
    joining with an equi-join to a table that contains an audit of all changes to the enrolment (in my source database - Sybase 12.5)
    then updating two fields in a tabke that is a second definition of the first fact
    The equi join uses the key to the enrolment table, plus a transaction type to identify only the creation of the record
    Between the join and the update of the table one field is going thru a trim (converting char to varchar2) then an expression that sets the value to "not_supplied" for cases where the value was null.
    The other field is a date (from sybase datetime to oracle Date)
    (they are the user that created the enrolment and the date the enrolment was actioned)
    I created this mapping by copying another mapping that does pretty much the same thing, deleting the join and table it was joining to and adding the audit table and new join.
    Both mapping deploy fine with no warnings, the original executes fine the variation gives the errors above.
    I have tried removing one then the other of the columns I am updating. (the same errors occur)
    I am about to re-write the mapping from scratch, but can anyone guess what is wrong with it ? (I'm using OWB 9.2.0.2.8)

    Thanks for the suggestion
    There are no "char(32767)"s in the package - altho there are "varchar2(32767)"s
    I have tried a variotion on the script, outputting the result to a new table instead of updating the enrolment - which ran fine so the error is in the update.
    I tried adding a step using the result in the temp table to update the enrolment table - and got my errors again. So there is something funny in my data. Nothing obvious shows.
    The full temp table contains 745292 records - when it failed 150 records had been written.
    I note that although I had expected only to find one record per enrolment, there are some where there are two (@#$%!! source system writing two "insert" audit records) - could my problem be that I am updating a record previously updated - where do I set the script to commit as it goes?
    Sandra

  • ORA-01002-Error in Select ... for update

    I would like to insert CLOB in a table (VP_EVENTS) with a primary key (eventid) with the following code:
    String content = "AAAAAAAAAAAAABBBBBBBBBBXXX";
    PreparedStatement cs = this.con.prepareStatement("INSERT INTO vp_events (eventid,term,participant)
    VALUES (?,?,empty_clob())");
    //Register IN-Parameter
    cs.setInt(1, 1);
    cs.setInt(2, 1);
    cs.setTimestamp(3, new java.sql.Timestamp( System.currentTimeMillis() ));
    //Execute statement
    cs.execute();
    cs.close();
    Statement stmt = con.createStatement();
    ResultSet clobLocatorSet = stmt.executeQuery( "SELECT PARTICIPANT FROM VP_EVENTS WHERE EVENTID=1 FOR UPDATE");
    // Get the CLOB-locator
    if (clobLocatorSet.next())
    oracle.sql.CLOB clob =
    ((oracle.jdbc.driver.OracleResultSet)
    clobLocatorSet).getCLOB(1);
    // Write CLOB-Data
    // The first parameter to plsql_write, is // the offset from which to start
    // writing, and the second parameter is the // data to be written.
    // plsql_length(), returns the length of // the data in the CLOB column
    countCLOB = clob.plsql_write(
    0,content.toCharArray());
    At the execution-point of the "Select for Update"-statement the oracle thin driver throws the Error "Fetch out of sequence ORA-01002".
    What's wrong?

    Connection conn = DriverManager.getConnection ("jdbc racle:thin:@myhost:1521:ORCL","scott", "tiger");
    conn.setAutoCommit(false);
    Statement stmt = conn.createStatement ();
    null

  • ERROR (ORA-01002)  when Ioading a table by UPDATE/INSERT

    I get the error message ORA-01002 ( Fetch out of sequence ) when I am loading a table by UPDATE/INSERT.
    At de Runtime Audit Viewer the process of loading update a number of register, in that case 44.050 and to the left register I get the error message that I show above.

    Can you please give us some details about your source and targets. I have used UPDATE/INSERT but I did not get this kind of error.
    rgds
    -AP

  • Error ORA-01002: fetch out of sequence

    Hi all,
    I created 3 cursors. The scenario is like following :
    Begin Cur A
    Begin FOR xx IN Cur B LOOP
    Begin FOR xx IN Cur C LOOP
    End LOOP Cur C;
    commit;
    End LOOP Cur B;
    End Cur A;
    When i run the program its display error ORA-01002: fetch out of sequence.
    The objective of my program is to insert into table and commit every transaction.
    Kindly share info with me why this error happened.
    TQ.
    tim

    Tim,
    Refer to the following:
    ORA-01002: fetch out of sequence
    Cause: This error means that a fetch has been attempted from a cursor which is no longer valid.
    Note that a PL/SQL cursor loop implicitly does fetches, and thus may also cause this error. There are a number of possible causes for this error, including:
    1) Fetching from a cursor after the last row has been retrieved and the ORA-1403 error returned.
    2) If the cursor has been opened with the FOR UPDATE clause, fetching after a COMMIT has been issued will return the error.
    3) Rebinding any placeholders in the SQL statement, then issuing a fetch before reexecuting the statement.
    Action:
    1) Do not issue a fetch statement after the last row has been retrieved - there are no more rows to fetch.
    2) Do not issue a COMMIT inside a fetch loop for a cursor that has been opened FOR UPDATE.
    3) Reexecute the statement after rebinding, then attempt to fetch again.
    HTH,
    Thierry
    Edited by: Thierry H. on May 4, 2011 12:30 PM Reformatting

  • BUG: preview report template errors with ORA-01002

    I've checked on my local install and on apex.oracle.com. I go into the Templates of Shared Components and filter on the Report Templates. Although the preview icon is displayed to allow me to preview the template, I always receive "ORA-01002: fetch out of sequence" on an error page. The only types of Report Templates I have are of type "Generic Columns" so not sure if the problem exists with "Named Columns."
    Can anyone confirm this or correct me on this?
    Shane.

    I wouldn't mind piggy-backing this to ask if the Report Template "shortcut" links at the top of the page can be updated to account for all sections that are now a part of the Report Template. "Before Each Row" and "After Each Row" sections are not listed in the shortcuts. There are also two shortcuts listed as "Before" and "After" which should probably be relabeled.
    Shane.

  • ORA-01002: fetch out of sequence- error when accesing oracle sp from c#

    We have a stored procedure when we exceute it from Sql plus tool ot Toad works fine. But when we call it from C# .ne code gives us the following error.
    ORA-01002: fetch out of sequence ORA-02063: preceding line from SQA1
    Please help.

    with out these lines it works
    (fae_primary_agent_ind = 'X') or
    ((fae_primary_agent_ind is null) and (agn_agt_comp_st_cd = ‘65’)
    This is the stored proc. It works in oracle. It does not work only when we call it from C#.
    CREATE OR REPLACE
    PROCEDURE abc (
    p_report_date IN VARCHAR2,
    p_cur OUT Getadrdata.t_cursor,
    p_run_mode OUT NUMBER
    AS
    v_report_dt DATE;
    backed_out NUMBER := 0;
    previously_paid NUMBER := 0;
    BEGIN
    v_report_dt := TO_DATE (p_report_date, 'DDMMYYYY');
    SELECT COUNT (*)
    INTO backed_out
    FROM r2t_adr_payment a, DUAL
    WHERE a.fap_acctg_dt = v_report_dt
    AND a.fap_status_cd = 'B';
    IF backed_out = 0
    THEN
         SELECT COUNT (*)
    INTO previously_paid
    FROM r2t_adr_payment a, DUAL
    WHERE a.fap_acctg_dt = v_report_dt
    AND a.fap_status_cd = 'P';
    END IF;
    IF backed_out > 0 or previously_paid > 0
    THEN
    p_run_mode := 2;
    OPEN p_cur FOR
    SELECT fae_agent_nbr agent_nbr, fae_ssn_last_4digits ssn_nbr,
    fae_address_ln1 address_line1, fae_address_ln2 address_line2,
    fae_city_nm city, fae_state_cd state, fae_zip_cd zip,
    fae_bus_phone business_phone, fae_supv_region_cd region,
    fae_territory_cd territory, fae_market_cd market,
    -- FAE_AGT_COMP_ST_CD COMP_STAT_CD,
    agn_agt_comp_st_cd comp_stat_cd, fae_emplmt_dt emp_date,
    fae_agent_type_cd status_cd, fae_first_nm first_name,
    fae_last_nm last_name,
    rpt_agent_bonus_class_id p_agent_bonus_class_id
    FROM r2t_adr_epc_agent_info LEFT OUTER JOIN rgt_points
    ON fae_agent_nbr = rpt_agent_nbr
    LEFT OUTER JOIN p1t_tot_agent ON fae_agent_nbr =
    agn_agent_nbr
    INNER JOIN r2t_adr_payment
    ON fae_agent_nbr = fap_primary_agent_nbr
    WHERE FAE_AGENT_TYPE_CD = '41'
    AND rpt_acctg_dt = v_report_dt
    AND v_report_dt BETWEEN agn_start_eff_dt AND agn_end_eff_dt
    AND fap_acctg_dt = v_report_dt
    AND fap_status_cd = 'B'
    UNION ALL
    SELECT fae_agent_nbr agent_nbr, fae_ssn_last_4digits ssn_nbr,
    fae_address_ln1 address_line1, fae_address_ln2 address_line2,
    fae_city_nm city, fae_state_cd state, fae_zip_cd zip,
    fae_bus_phone business_phone, fae_supv_region_cd region,
    fae_territory_cd territory, fae_market_cd market,
    -- FAE_AGT_COMP_ST_CD COMP_STAT_CD,
    agn_agt_comp_st_cd comp_stat_cd, fae_emplmt_dt emp_date,
    fae_agent_type_cd status_cd, fae_first_nm first_name,
    fae_last_nm last_name,
    0 p_agent_bonus_class_id
    FROM r2t_adr_epc_agent_info
    LEFT OUTER JOIN p1t_tot_agent ON fae_agent_nbr =
    agn_agent_nbr
    INNER JOIN r2t_adr_payment
    ON fae_agent_nbr = fap_primary_agent_nbr
    WHERE fae_agent_type_cd = '13'
    AND v_report_dt BETWEEN agn_start_eff_dt AND agn_end_eff_dt
    AND fap_acctg_dt = v_report_dt
    AND fap_status_cd = 'B';
    ELSE
    p_run_mode := 1;
    OPEN p_cur FOR
    SELECT fae_agent_nbr agent_nbr, fae_ssn_last_4digits ssn_nbr,
    fae_address_ln1 address_line1, fae_address_ln2 address_line2,
    fae_city_nm city, fae_state_cd state, fae_zip_cd zip,
    fae_bus_phone business_phone, fae_supv_region_cd region,
    fae_territory_cd territory, fae_market_cd market,
    -- FAE_AGT_COMP_ST_CD COMP_STAT_CD,
    agn_agt_comp_st_cd comp_stat_cd, fae_emplmt_dt emp_date,
    fae_agent_type_cd status_cd, fae_first_nm first_name,
    fae_last_nm last_name,
    rpt_agent_bonus_class_id p_agent_bonus_class_id
    FROM r2t_adr_epc_agent_info LEFT OUTER JOIN rgt_points
    ON fae_agent_nbr = rpt_agent_nbr
    LEFT OUTER JOIN p1t_tot_agent ON fae_agent_nbr =
    agn_agent_nbr
    WHERE rpt_acctg_dt = v_report_dt
    -- Next line for testing of a subset of data - testing purposes only
    -- AND FAE_SUPV_REGION_CD ='002'
    AND FAE_AGENT_TYPE_CD = '41'
    AND (
    (RPT_AGENT_BONUS_CLASS_ID = '3' AND SUBSTR(FAE_EMPLMT_DT,1,2) <> '01' AND ADD_MONTHS(FAE_EMPLMT_DT, 7 ) <= v_report_dt) OR
    (RPT_AGENT_BONUS_CLASS_ID = '3' AND SUBSTR(FAE_EMPLMT_DT,1,2) = '01' AND ADD_MONTHS(FAE_EMPLMT_DT, 6 ) <= v_report_dt) OR
    (RPT_AGENT_BONUS_CLASS_ID = '1')
    AND (
    (fae_primary_agent_ind = 'X') or
    ((fae_primary_agent_ind is null) and (agn_agt_comp_st_cd = ‘65’)
    AND v_report_dt BETWEEN agn_start_eff_dt AND agn_end_eff_dt
    UNION ALL
    SELECT fae_agent_nbr agent_nbr, fae_ssn_last_4digits ssn_nbr,
    fae_address_ln1 address_line1, fae_address_ln2 address_line2,
    fae_city_nm city, fae_state_cd state, fae_zip_cd zip,
    fae_bus_phone business_phone, fae_supv_region_cd region,
    fae_territory_cd territory, fae_market_cd market,
    -- FAE_AGT_COMP_ST_CD COMP_STAT_CD,
    agn_agt_comp_st_cd comp_stat_cd, fae_emplmt_dt emp_date,
    fae_agent_type_cd status_cd, fae_first_nm first_name,
    fae_last_nm last_name, 0 p_agent_bonus_class_id
    FROM r2t_adr_epc_agent_info LEFT OUTER JOIN p1t_tot_agent
    ON fae_agent_nbr = agn_agent_nbr
    WHERE fae_agent_type_cd = '13'
    -- Next line for testing of a subset of data - testing purposes only
    -- AND FAE_SUPV_REGION_CD ='002'
    AND fae_primary_agent_ind = 'X'
    AND v_report_dt BETWEEN agn_start_eff_dt AND agn_end_eff_dt;
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    --DBMS_OUTPUT.PUT_LINE ('no data ' || SQLERRM);
    NULL;
    WHEN OTHERS
    THEN
    --DBMS_OUTPUT.PUT_LINE ('error ' || SQLERRM);
    --OPEN p_cur FOR
    -- SELECT NULL
    -- FROM DUAL;
              RAISE;
    END abc;

  • WLS 5.1 to 6.1 porting issue: RequiresNew & ORA-01002 error

    Repost from the EJB group
    Environment:
    WLS 6.1.2 on WINNT w/SP6a
    java: 1.3.1 that ships with WLS 6.1
    DB: Oracle 8.1.6 (using TRANSACTION_READ_COMMITTED exclusively)
    I'm currently upgrading our application from 5.1 (ejb 1.1) to
    6.1 (ejb 2.0). I've also consolidated our 55 separate ejb jars
    into a single jar (with all 55 ejbs). Because of 1.1 entity bean
    issues, currently all our ejbs are SessionBeans. Everything works
    under 5.1 with our test Oracle instance, the 6.1 test environment
    is using the same database instance.
    I'm seeing several problems.
    Here's #1
    With the same TCUSecurityDataAccessSessionBean::updateIfNeeded
    source code and same database instance. 5.1 updates correctly,
    6.1 throws this SQLException. So, I figure its got to be a WLS 6.1 issue or
    my configuration. - I alway suspect me ;)
    ERROR - ORA-01002: fetch out of sequence
    (com.eoriginal.engine.core.session.basicAccess.TCUSecurityDataAccessSessionB
    ean_ridhfi_Impl::updateIfNeeded)
    java.sql.SQLException: ORA-01002: fetch out of sequence
    This method should be configured with transaction context of: RequiresNew
    Has the 6.1 handling of RequiresNew changed that radically?
    I'm looking for suggestions on how to debug this further.
    TIA
    Gordon
    ------------- ejb-jar.xml (edited) ------------------------
    <ejb-jar>
    <small-icon>images/green-cube.gif</small-icon>
    <enterprise-beans>
    <!-- TCUSecurityDataAccessSession -->
    <session>
    <small-icon>images/orange-cube.gif</small-icon>
    <ejb-name>TCUSecurityDataAccessSession</ejb-name>
    <home>com.eoriginal.engine.core.session.basicAccess.TCUSecurityDataAccessSes
    sionHome</home>
    <remote>com.eoriginal.engine.core.session.basicAccess.TCUSecurityDataAccessS
    ession</remote>
    <ejb-class>com.eoriginal.engine.core.session.basicAccess.TCUSecurityDataAcce
    ssSessionBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    <method-permission>
    <description></description>
    <role-name>****</role-name> <!-- deleted for security -->
    <method>
    <ejb-name>TCUSecurityDataAccessSession</ejb-name>
    <method-name>*</method-name>
    </method>
    </method-permission>
    <!-- TCUSecurityDataAccessSession -->
    <container-transaction>
    <method>
    <ejb-name>TCUSecurityDataAccessSession</ejb-name>
    <method-name>updateIfNeeded</method-name>
    </method>
    <trans-attribute>RequiresNew</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>TCUSecurityDataAccessSession</ejb-name>
    <method-name>peek</method-name>
    </method>
    <trans-attribute>Supports</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    ------------- weblogic-ejb-jar.xml (uninteresting) ------------------------
    ------------- config.xml (edited) ------------------------
    <JDBCConnectionPool CapacityIncrement="5"
    DriverName="oracle.jdbc.driver.OracleDriver"
    InitialCapacity="10" MaxCapacity="100" Name="d2Pool"
    Password="*****
    Properties="user=d2engine;STATEMENT_CACHE_SIZE=200"
    Targets="myserver" URL="jdbc:oracle:thin:@*****"/>
    <JDBCTxDataSource JNDIName="jdbc/d2Pool" Name="jdbc/d2Pool"
    PoolName="d2Pool" Targets="myserver"/>
    ORA-01002 fetch out of sequence
    Cause: In a host language program, a FETCH call was issued out of sequence.
    A successful parse-and-execute call must be issued before a fetch.
    This can occur if an attempt was made to FETCH from an active set after
    all records have been fetched.
    This may be caused by fetching from a SELECT FOR UPDATE cursor after a
    commit.
    A PL/SQL cursor loop implicitly does fetches and may also cause this error.
    Action: Parse and execute a SQL statement before attempting to fetch the
    data.

    Solved.
    The 8.1.6 driver wasn't the problem.
    It turned out that our ConnectionPool utility class wasn't configured
    properly
    and when I thought that I was going TxDatasource, I was actually only
    getting
    a straight Connection. No Tx, so Oracle didn't have one open for the "FOR
    UPDATE"
    clause. Now if someone could help on my classloader question in the EJB
    group ;)
    - Gordon
    "Slava Imeshev" <[email protected]> wrote in message
    news:[email protected]...
    Gordon,
    Oracle 8.1.6 driver proved to be buggy and unstable.
    Can you update your oracle thin driver to the newest
    one? It's available from the otn.oracle.com.
    Could you also post the questionable code here, especially
    in the part related to obtaining connection, executing
    stataments, fetching results and obtaining TXs, if any?
    Regards,
    Slava Imeshev
    "Gordon Twaddell" <[email protected]> wrote in message
    news:[email protected]...
    Sree,
    I didn't mention that I'm using the Oracle thin JDBC driver
    (8.1.6.1)
    and its in the CLASSPATH.
    Slava,
    I tried the stmt.setFetchSize(). I got the same result.
    Gordon
    "Sree Bodapati" <[email protected]> wrote in message
    news:[email protected]...
    Hi Gordon,
    One possibility is the environment variable PATH might be pointing to
    an
    older version of the library files for the WebLogic jDriver forOracle.
    Check if the PATH is set to point to the right weblogicoci37.dll (inthe
    <WL_HOME for 6.1>\bin\oci817_8) and make sure your oracle_home is setto
    point to the right folders as well.
    hth
    sree
    "Gordon Twaddell" <[email protected]> wrote in message
    news:[email protected]...
    Repost from the EJB group
    Environment:
    WLS 6.1.2 on WINNT w/SP6a
    java: 1.3.1 that ships with WLS 6.1
    DB: Oracle 8.1.6 (using TRANSACTION_READ_COMMITTED exclusively)
    I'm currently upgrading our application from 5.1 (ejb 1.1) to
    6.1 (ejb 2.0). I've also consolidated our 55 separate ejb jars
    into a single jar (with all 55 ejbs). Because of 1.1 entity bean
    issues, currently all our ejbs are SessionBeans. Everything works
    under 5.1 with our test Oracle instance, the 6.1 test environment
    is using the same database instance.
    I'm seeing several problems.
    Here's #1
    With the same TCUSecurityDataAccessSessionBean::updateIfNeeded
    source code and same database instance. 5.1 updates correctly,
    6.1 throws this SQLException. So, I figure its got to be a WLS 6.1
    issue
    or
    my configuration. - I alway suspect me ;)
    ERROR - ORA-01002: fetch out of sequence
    (com.eoriginal.engine.core.session.basicAccess.TCUSecurityDataAccessSessionB
    ean_ridhfi_Impl::updateIfNeeded)
    java.sql.SQLException: ORA-01002: fetch out of sequence
    This method should be configured with transaction context of:RequiresNew
    Has the 6.1 handling of RequiresNew changed that radically?
    I'm looking for suggestions on how to debug this further.
    TIA
    Gordon
    ------------- ejb-jar.xml (edited) ------------------------
    <ejb-jar>
    <small-icon>images/green-cube.gif</small-icon>
    <enterprise-beans>
    <!-- TCUSecurityDataAccessSession -->
    <session>
    <small-icon>images/orange-cube.gif</small-icon>
    <ejb-name>TCUSecurityDataAccessSession</ejb-name>
    <home>com.eoriginal.engine.core.session.basicAccess.TCUSecurityDataAccessSes
    sionHome</home>
    <remote>com.eoriginal.engine.core.session.basicAccess.TCUSecurityDataAccessS
    ession</remote>
    <ejb-class>com.eoriginal.engine.core.session.basicAccess.TCUSecurityDataAcce
    ssSessionBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    <method-permission>
    <description></description>
    <role-name>****</role-name> <!-- deleted for security -->
    <method>
    <ejb-name>TCUSecurityDataAccessSession</ejb-name>
    <method-name>*</method-name>
    </method>
    </method-permission>
    <!-- TCUSecurityDataAccessSession -->
    <container-transaction>
    <method>
    <ejb-name>TCUSecurityDataAccessSession</ejb-name>
    <method-name>updateIfNeeded</method-name>
    </method>
    <trans-attribute>RequiresNew</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>TCUSecurityDataAccessSession</ejb-name>
    <method-name>peek</method-name>
    </method>
    <trans-attribute>Supports</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    ------------- weblogic-ejb-jar.xml(uninteresting) ------------------------
    ------------- config.xml (edited) ------------------------
    <JDBCConnectionPool CapacityIncrement="5"
    DriverName="oracle.jdbc.driver.OracleDriver"
    InitialCapacity="10" MaxCapacity="100" Name="d2Pool"
    Password="*****
    Properties="user=d2engine;STATEMENT_CACHE_SIZE=200"
    Targets="myserver" URL="jdbc:oracle:thin:@*****"/>
    <JDBCTxDataSource JNDIName="jdbc/d2Pool" Name="jdbc/d2Pool"
    PoolName="d2Pool" Targets="myserver"/>
    ORA-01002 fetch out of sequence
    Cause: In a host language program, a FETCH call was issued out ofsequence.
    A successful parse-and-execute call must be issued before a fetch.
    This can occur if an attempt was made to FETCH from an active set
    after
    all records have been fetched.
    This may be caused by fetching from a SELECT FOR UPDATE cursor
    after
    a
    commit.
    A PL/SQL cursor loop implicitly does fetches and may also cause
    this
    error.
    Action: Parse and execute a SQL statement before attempting to fetch
    the
    data.

  • ORA-01002: fetch out of sequence error when using Oracle Thin Driver 9i with Weblogic 6.1

    The simple program below is a client that executes a SELECT query -
    there are 13 rows in the table, of which 10 are printed when I run the
    program, then after that the ORA-01002 error is reported. I am not
    doing anything with LOBs, or updates. I've tried putting
    con.setAutoCommit(false) as well, but that does not do anything.
    Why am I getting this error? Can anyone help.
    Thanks
    -H
    Context ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL,
    "t3://127.0.0.1:7001");
    PreparedStatement stmt = null;
    ResultSet rs = null;
    UserTransaction ut = null;
    try {
    ctx = new InitialContext(ht);
    javax.sql.DataSource ds
    = (javax.sql.DataSource) ctx.lookup ("jtaXADS");
    java.sql.Connection conn = ds.getConnection();
    // You can now use the conn object to create
    // Statements and retrieve result sets:
    ut = (UserTransaction)
    ctx.lookup("javax.transaction.UserTransaction");
    ut.begin();
    stmt = conn.prepareStatement("select firstname,surname from
    EMPLOYEE ");
    stmt.executeQuery();
    rs = stmt.getResultSet();
    // Close the statement and connection objects when you are finished:
    while (rs.next())
    System.out.println("Result is " + rs.getString("firstname") + " " +
    rs.getString("surname"));
    ut.commit();
    stmt.close();
    conn.close();
    catch (Exception e) {
    e.printStackTrace();
    // a failure occurred
    finally {
    try {ctx.close();
    rs.close();}
    catch (Exception e) {
    // a failure occurred
    e.printStackTrace();

    Thanks everybody.
    I have tried this, calling ut.begin() first before getConnection,
    however no difference. However the problem goes away if I call
    stmt.setFetchSize(100);
    But I would prefer not to have to code this in every time!!!
    I see there is a setting within Weblogic Admin console to see the
    row-prefetch, but that is already set to 45 rows, so why do have to
    explicitly call stmt.setFetchSize(100)!!!
    Thanks
    -H
    "Carl Lawstuen" <[email protected]> wrote in message news:<[email protected]>...
    Agreed. The transaction must start before the connection. This is what
    is most likely causing the error.
    "Nils Winkler" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    one more thing: The UserTransaction has to be started before you obtain
    the connection, not after.
    Nils
    Humphrey wrote:
    The simple program below is a client that executes a SELECT query -
    there are 13 rows in the table, of which 10 are printed when I run the
    program, then after that the ORA-01002 error is reported. I am not
    doing anything with LOBs, or updates. I've tried putting
    con.setAutoCommit(false) as well, but that does not do anything.
    Why am I getting this error? Can anyone help.
    Thanks
    -H
    Context ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL,
    "t3://127.0.0.1:7001");
    PreparedStatement stmt = null;
    ResultSet rs = null;
    UserTransaction ut = null;
    try {
    ctx = new InitialContext(ht);
    javax.sql.DataSource ds
    = (javax.sql.DataSource) ctx.lookup ("jtaXADS");
    java.sql.Connection conn = ds.getConnection();
    // You can now use the conn object to create
    // Statements and retrieve result sets:
    ut = (UserTransaction)
    ctx.lookup("javax.transaction.UserTransaction");
    ut.begin();
    stmt = conn.prepareStatement("select firstname,surname from
    EMPLOYEE ");
    stmt.executeQuery();
    rs = stmt.getResultSet();
    // Close the statement and connection objects when you are finished:
    while (rs.next())
    System.out.println("Result is " + rs.getString("firstname") + " " +
    rs.getString("surname"));
    ut.commit();
    stmt.close();
    conn.close();
    catch (Exception e) {
    e.printStackTrace();
    // a failure occurred
    finally {
    try {ctx.close();
    rs.close();}
    catch (Exception e) {
    // a failure occurred
    e.printStackTrace();
    ============================
    [email protected]

  • ORA 01002 error - Fetch out of sequence

    I am using COMMIT statement inside CURSOR FOR LOOP after inserting records. I am not using FOR UPDATE. But still I see fetch out of sequence error. I need to do commit intervals of every 1000 insert statements. How to resolve this error?

    The reason of your error from oracle point of view is --
    ORA-01002: fetch out of sequence
    Cause: This error means that a fetch has been attempted from a cursor which is no longer valid. Note that a PL/SQL cursor loop implicitly does fetches, and thus may also cause this error. There are a number of possible causes for this error, including: 1) Fetching from a cursor after the last row has been retrieved and the ORA-1403 error returned. 2) If the cursor has been opened with the FOR UPDATE clause, fetching after a COMMIT has been issued will return the error. 3) Rebinding any placeholders in the SQL statement, then issuing a fetch before reexecuting the statement.
    Action: 1) Do not issue a fetch statement after the last row has been retrieved - there are no more rows to fetch. 2) Do not issue a COMMIT inside a fetch loop for a cursor that has been opened FOR UPDATE. 3) Reexecute the statement after rebinding, then attempt to fetch again.
    Now, my question is - are attempting any fetches inside any for loop - which will throw this error? Just check it - and let us know your feedback.
    Regards.
    Satyaki De.

  • ORA-01002 error

    With the Oracle 8.1.7 thin driver I am getting an ORA-01002 error -fetch
    out of sequence
    I am setting the autocommit to false. Is there something else I should
    do. If I know at most one row is going to be fetched should I set the
    fetch size to 1 ? Will that remove the problem ?
    Thanks.

    Aswin
    Set the statement fetch size to be at least the result set size.
    stmt.setFetchSize()
    Deepak
    Aswin Dinakar wrote:
    With the Oracle 8.1.7 thin driver I am getting an ORA-01002 error -fetch
    out of sequence
    I am setting the autocommit to false. Is there something else I should
    do. If I know at most one row is going to be fetched should I set the
    fetch size to 1 ? Will that remove the problem ?
    Thanks.

  • 11.5.10.2-Error:1002,ORA-01002

    Hi All,
    Application 11.5.10.2,database 9.2.0.6,OS sun solaris,
    An Unexpected Error -1002 has occured - a log file has been created. ORA-01002: fetch out of sequence
    Please help me inthis regard
    thanks in advance.

    Hi,
    Please mention how do you get the error (mention the steps to reproduce the issue), and what changes have been done recently.
    If you have any errors in Apache/Database log files, please post it here.
    Did you run AutoConfig and make sure it completes successfully?
    Regards,
    Hussein

  • Autonomous Transactions & error ORA-01002

    Either there's a bug w/ Autonomous Transactions or the documentation is incomplete because the AT is not working when
    called from within Cursor Loop.
    here's the outline:
    CURSOR acct_cur IS ...FOR UPDATE OF a.account_nm...
    FOR acct_rec IN acct_cur LOOP
    fis_rte_util.print_msg (...) ---autonomous transaction writes to a logging table
    ---w/ commit
    UPDATE ca_account_t
    SET account_nm = acct_rec.account_nm....
    this update statement causes a ORA-01002: fetch out of sequence exception. if
    i comment out the print_msg line it works just fine. its as if the commit in the
    AT is causing the problem. according to the documention, there should be no
    interference between these 2 blocks.
    thanks for any info or insight,
    swg
    null

    Tim,
    Refer to the following:
    ORA-01002: fetch out of sequence
    Cause: This error means that a fetch has been attempted from a cursor which is no longer valid.
    Note that a PL/SQL cursor loop implicitly does fetches, and thus may also cause this error. There are a number of possible causes for this error, including:
    1) Fetching from a cursor after the last row has been retrieved and the ORA-1403 error returned.
    2) If the cursor has been opened with the FOR UPDATE clause, fetching after a COMMIT has been issued will return the error.
    3) Rebinding any placeholders in the SQL statement, then issuing a fetch before reexecuting the statement.
    Action:
    1) Do not issue a fetch statement after the last row has been retrieved - there are no more rows to fetch.
    2) Do not issue a COMMIT inside a fetch loop for a cursor that has been opened FOR UPDATE.
    3) Reexecute the statement after rebinding, then attempt to fetch again.
    HTH,
    Thierry
    Edited by: Thierry H. on May 4, 2011 12:30 PM Reformatting

  • ORA-01002: fetch out of sequence error

    Hello friends,
    I m facing a prob using a cursor for update.
    here is a piece of code:
    DECLARE
                   CURSOR c_tot_inv_qty (p_prd_id tr_periods.period_id%TYPE) IS
    SELECT total_inv_qty, item_id, period_id, dc_id
    FROM inv_dc_tmp
    WHERE period_id = p_prd_id + 1
    FOR UPDATE OF total_inv_qty;
    BEGIN
              FOR pd IN (     SELECT period_id
                             FROM tr_periods
                             WHERE status_flag = 1
                             AND period_id >= 46
    LOOP
                   FOR t_tot_inv_qty IN c_tot_inv_qty(pd.period_id) LOOP
                        BEGIN
    SELECT inv_forecast_qty
    INTO l_inv_fc_qty
    FROM inv_dc_tmp
    WHERE item_id = t_tot_inv_qty.item_id
    AND period_id = pd.period_id
    AND dc_id = t_tot_inv_qty.dc_id;
                        EXCEPTION
                             WHEN NO_DATA_FOUND THEN
                                  l_inv_fc_qty := 0;
                        END;
    UPDATE inv_dc_tmp
    SET total_inv_qty = l_inv_fc_qty
    WHERE CURRENT OF c_tot_inv_qty;
                   END LOOP;
              END LOOP;
              COMMIT;
    END;
    i have written commit after the loop..but still it raise an error ORA-01002: fetch out of sequence
    i m unable to find out the soln
    i need ur help.
    Thanks
    RSD

    I'm not sure what your code is trying to accomplish, but give this a whirl. It might be better than all that looping and cursors. I don't have any sample data/tables so I'm largely guessing here.
    update inv_dc_tmp i
    set    i.total_inv_qty =
              (select sum(t.inv_forecast_qty)
               from   inv_dc_tmp t
                     ,tr_periods p
               where  t.period_id = p.period_id
               and    p.status_flag = 1
               and    p.period_id >= 46
               and    t.period_id     = i.period_id - 1
               and    t.item_id       = i.item_id
               and    t.dc_id         = i.dc_id
    where exists
              (select 1
               from   tr_periods p
               where  p.period_id = i.period_id - 1
               and    p.status_flag = 1
               and    p.period_id >= 46
    ;Extremely UNtested.

  • ORA-01002 run-time error for help

    Hi, All:
    I modified little in Sample10.pc of PRO*C sample code to fit both NT and
    Linux using 8i version precompiler, with VC++ and GCC Compiler respectively.
    All process were fine when they connected to a DB Server(8i version), but
    when they connected to the other Server(8 version), the error : ORA-01002
    (Fetch out of sequence) was always issued at run-time. I checked the error
    message and found that the program was stuck on the "PREPARE" description. I
    have spent much more time debugging, but it still didn't work. Could you
    help me? I'm so preciated.
    Best regards,
    Yen-Gou Pan
    null

    Hello,
    This error comes when  there is an OpenSQL statement that tries to insert a record into a database table that is already existing.
    You need to implement  SAP Note 196113 and 1041894 along with technical consultant to help and overcome the issue.
    Br,
    Tushar

Maybe you are looking for

  • In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function?

    In Numbers, how do I lock in the date and time data when an IF/THEN formula is used with the "NOW" function? =IF(I127,NOW()," ") I127 equals a check box. The formula retuns a value of the current date and time when a check is placed in the box. How d

  • ADF/Swing: changing iterator in runtime before displaying panel

    Is it possible ,before displaying panel, to change iterator name that was specified in design time and is placed in panel.pageDef xml file and this way display panel with different iterator than is in panel.pageDef file? If yes, is it posible display

  • Adding snare to 'Audio to Score' kick

    hi list, first time poster...so i have successfully created a midi file of my drummer's kick and have subbed out with the sample i want via the 'audio to score' feature. now i want to add the snare to the same audio instrument. how do i do that? when

  • Conncet between BW and BW.

    Hi  all. Our company run  two BW 7.0 system. Now, I'm trying to connect between BW system and BW system. In order words, one bw system will become other BW system's source system. however, i have no idea how to connect BW systems. Can any body tell m

  • Complex Arrow

    Hi Guys, I got the following issue.. and it seems to be rare too (at least I didn't find any hint yet that works): I want the user to enter a Complex Number by using graphical means (e.g. 2D Compass Plot, or XY-Graph). In end version the user is supp