Database selection with Invalid Cursor error in RSDRI_INFOPROV_READ

Hi Everyone.
I am using RSDRI_INFOPROV_READ Function module for reading data from a multiprovider.
Logic of the code is as following
while <more data>
CALL RSDRI_INFOPROV_READ reading data in E_T_DATA
Append lines of E_T_DATA to EO_T_DATA.
If total lines of data in EO_T_DATA > 200000
<save EO_T_DATA in a file using GUI_DOWNLOAD>
<clear EO_T_DATA>
EndIF
EndWhile.
As soon as number of record exceed 200000 first file is saved, but after that next data call results in error.
Error says "Database selection with invalid cursor".
I suspect that this because of call to FM GUI_DOWNLOAD. While calling this FM after RSDRI_INFOPROV_READ causes system to commit and again the cursor is tried to open in next call casuing it to fail.
But it is imperative for me to save data in file at regular intervals as data volume is huge.
Any pointers in this direction will be helpful.

Hi Everyone.
I am using RSDRI_INFOPROV_READ Function module for reading data from a multiprovider.
Logic of the code is as following
while <more data>
CALL RSDRI_INFOPROV_READ reading data in E_T_DATA
Append lines of E_T_DATA to EO_T_DATA.
If total lines of data in EO_T_DATA > 200000
<save EO_T_DATA in a file using GUI_DOWNLOAD>
<clear EO_T_DATA>
EndIF
EndWhile.
As soon as number of record exceed 200000 first file is saved, but after that next data call results in error.
Error says "Database selection with invalid cursor".
I suspect that this because of call to FM GUI_DOWNLOAD. While calling this FM after RSDRI_INFOPROV_READ causes system to commit and again the cursor is tried to open in next call casuing it to fail.
But it is imperative for me to save data in file at regular intervals as data volume is huge.
Any pointers in this direction will be helpful.

Similar Messages

  • Load data error: Database selection with invalid cursor (sm21)

    hi experts,
    when I execute processchar, it occur some system error:
    "Database selection with invalid cursor ",
    "Documentation for system log message BY 7 :
    The database interface was called by a cursor (in a FETCH or CLOSE
    cursor operation) that is not flagged as opened. This can occur if a
    COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
    opened cursors), followed by another attempt to access the cursor (for
    example, the next time the loop is executed). "
    the error msg occur when apply bw support package19.
    data from DSO to CUBE, Transferred Recodes is not zero, but Added Recodes is zero.
    Request status always yellow, process is running.
    current sys info: BI7 and BW19, BASIS17,PI_BASIS17, the database is oracle10g R2.
    thanks for your help.

    I have solved this issue, The Oracle checkpoint not complete.
    thanks,
    xwu.

  • Processchar occur error:  Database selection with invalid cursor (sm21)

    hi,
       when I execute processchar, it occur some system error:
    "Database selection with invalid cursor ",
    "Documentation for system log message BY 7 :
    The database interface was called by a cursor (in a FETCH or CLOSE
    cursor operation) that is not flagged as opened. This can occur if a
    COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
    opened cursors), followed by another attempt to access the cursor (for
    example, the next time the loop is executed). "
    the error msg occur when apply bw support package19.
    data from DSO to CUBE, Transferred Recodes is not zero, but Added Recodes is zero.
    Request status always yellow, process is running.
    current sys info: BI7 and BW19, BASIS17,PI_BASIS17, the database is oracle10g R2.
    thanks for your help.

    I have solved this issue , The Oracle checkpoint is not complete.
    thanks,
    xwu.

  • Database selection with invalid cursor !

    hi experts,
        When  execute SAP BW processchar, it occur some system error: (sm21)
    Database selection with invalid cursor
    The database interface was called by a cursor (in a FETCH or CLOSE
    cursor operation) that is not flagged as opened. This can occur if a
    COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
    opened cursors), followed by another attempt to access the cursor (for
    example, the next time the loop is executed).
    this error occur when apply bw support package 19.
    sap notes 1118584 Solution is: Import Support Package 17 . but my support package is 19.
    how can i solve this error?
    thanks,
    xwu.

    I am only assuming things, but it might be worth to look closely if you were experiencing an ORA- error during the execution. This could have caused a rollback and thus closed the cursor. Please check the job log, the workprocess trace (dev_wX file) and the system log SM21 and ST22 as well.
    Besides that check the oracle alertlog and the usertrace destination.
    Best regards, Michael

  • Database selection with invalid cursor with MaxDB database

    Hi Experts,
    I encountered the this error:
    "Database selection with invalid cursor
    The database interface was called by a cursor (in a FETCH or CLOSE
    cursor operation) that is not flagged as opened. This can occur if a
    COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
    opened cursors), followed by another attempt to access the cursor (for
    example, the next time the loop is executed)."
    We are using bw support package 19 early this month. Previously is working fine but this problem occured from the last 2 days.
    We are using MaxDB database.
    Really appreciate any speedy responds.

    Hi,
    We finally resolved the issue.
    The solution:
    We check the RFC connection test in SM59. There are connection error.
    There is an error that related J2EE_ADMIN user.
    SO we reset the J2EE_ADMIN id in SU01.
    The problem goes away.
    Many thanks

  • "Invalid Cursor" Error in Form

    Hi,
    I wrote a procedure that take a REF CURSOR as an IN OUT argument. This procedure does an "OPEN cursor FOR qry" with a dynamic query:
    OPEN l_cursor FOR
           'SELECT A '||
             'FROM B '||
            'WHERE C = :l_var'
         USING myVar;After calling the procedure, I do a LOOP with FETCH.
    It works well when I use it in SQL*Plus with DBMS_OUTPUT but it returns a "ORA-01001 invalid cursor" error in Forms.
    Any help is welcome!
    Regards,
    Olivier.

    I found a solution on Metalink:
    Note:170881.1
    Note: 1007395.6
    Olivier.

  • Invalid cursor error in procedure

    i am writing a procedure in which i have make use of cursor........it is giving me error INVALID CURSOR
    on running
    i have used this cursor with WITH CLAUSE....
    when i am executing or running this procedure this giving me invalid cursor error
    create or replace
    procedure USP_UPDATEDRUGORDERDTL
    v_pServiceid IN NUMBER DEFAULT NULL ,
    v_pServRendered IN NUMBER DEFAULT NULL ,
    v_pSchDateTime IN DATE DEFAULT NULL ,
    v_pOrdQty IN FLOAT DEFAULT NULL ,
    v_billingclassid IN NUMBER DEFAULT NULL ,
    v_pOrdID IN NUMBER DEFAULT NULL ,
    v_UpdatedBy IN NUMBER DEFAULT NULL ,
    v_prender IN NUMBER DEFAULT 0 ,
    v_pInsertedByUserID IN VARCHAR2 DEFAULT NULL ,
    v_pInsertedON IN DATE DEFAULT NULL ,
    v_pDrugID IN NUMBER DEFAULT 0 ,
    v_pRate IN FLOAT DEFAULT 0 ,
    v_pBatchId IN NUMBER DEFAULT 0 ,
    v_OrderSource IN VARCHAR2 DEFAULT NULL ,
    v_pInsertedMacID IN VARCHAR2 DEFAULT NULL ,
    v_pInsertedIPAddress IN VARCHAR2 DEFAULT NULL ,
    v_pOldOrdID IN NUMBER DEFAULT NULL,
    v_plocid in char DEFAULT NULL
    AS
    vr_pConsumptionID NUMBER(10,0);
    vr_pSavedQty NUMBER(10,3);
    vr_pReturnQty NUMBER(10,3);
    vr_Qty NUMBER(10,3);
    begin
    vr_pSavedQty := 0;
    vr_pReturnQty := v_pOrdQty;
    declare
    cursor ordDtl_cur is -----cursor declaration
    with --- with clause used with cursor
    Q1 AS
    Select NVL(ConsumptionID,0) As ConsumptionID,Sum(OrdQty) As OrdQty,
    OrdID,DrugID,BatchID, locid from Orderdtl
    Where OrdID = v_pOldOrdID and DrugID = v_pDrugID And BatchID = v_pBatchID and NVL(Cancelled,0) = 0
    Group By OrdID,DrugID,BatchID,ConsumptionID
    Order By ConsumptionID asc
    Q2 AS
    SELECT NVL(OrderDtl.ConsumptionID,0) As ConsumptionID,(SUM(OrderDtl.OrdQty)) As OrdQty,
    IvPatientIssueReturnDtl.OrderID as OrdID,OrderDtl.DrugID,OrderDtl.BatchID,OrderDtl.locid
    FROM OrderDtl INNER JOIN
    IvPatientIssueReturnDtl ON OrderDtl.OrdID = IvPatientIssueReturnDtl.NewOrderId AND
    OrderDtl.DrugId = IvPatientIssueReturnDtl.ItemId AND OrderDtl.BatchId = IvPatientIssueReturnDtl.BatchId
    WHERE (OrderDtl.BatchId = v_pBatchID) AND (IvPatientIssueReturnDtl.OrderId = v_pOldOrdID)
    AND (OrderDtl.DrugID = v_pDrugID) and NVL(OrderDtl.Cancelled,0) = 0
    Group By IvPatientIssueReturnDtl.OrderID,OrderDtl.DrugID,OrderDtl.BatchID,OrderDtl.ConsumptionID
    Order By OrderDtl.ConsumptionID asc
    Select
    Q1.ConsumptionID,(Sum(NVL(Q1.OrdQty,0)) + Sum(NVL(Q2.OrdQty,0))) As OrdQty,
    Q1.OrdID,Q1.DrugID,Q1.BatchID,Q1.locid
    from
    Q1 ,Q2
    where
    Q1.OrdID =Q2.OrdID(+)
    and
    Q1.BatchID =Q2.BatchID(+)
    and
    Q1.DrugID =Q2.DrugID(+)
    and
    Q1.ConsumptionID =Q2.ConsumptionID(+)
    Group By Q1.OrdID,Q1.BatchID,Q1.DrugID,Q1.ConsumptionID;
    TYPE ordDtl_trec is TABLE of ordDtl_cur%ROWTYPE index by PLS_INTEGER;
    l_ordDtl ordDtl_trec; ---- cursor syntax
    begin
    if ordDtl_cur%ISOPEN then
    open ordDtl_cur; --------------opening cursor
    end if;
    loop
    -- fetch data into cursor---
    fetch ordDtl_cur
    bulk collect into
    l_ordDtl;
    -----perform logic--------------------
    for indx IN 1..l_ordDtl.COUNT loop
    if vr_pSavedQty <> vr_pReturnQty then
    If v_pOrdQty <= (vr_pReturnQty - vr_pSavedQty) then
    vr_pSavedQty := vr_pSavedQty + v_pOrdQty;
    vr_Qty := v_pOrdQty;
    else
    vr_Qty := (vr_pReturnQty - vr_pSavedQty);
    vr_pSavedQty := vr_pSavedQty + (vr_pReturnQty - vr_pSavedQty);
    end if;
    end if;
    end loop;
    exit when ordDtl_cur%NOTFOUND;
    end loop;
    CLOSE ordDtl_cur; ---- closing cursor
    end;
    end;

    Hello.
    Very simple.
    You are using cursor name before opening it.
    Here is the problem.
      if ordDtl_cur%ISOPEN then
       open ordDtl_cur; --------------opening cursor
      end if;
    end if;Please change your code like this
    comment IF statement use only OPEN  ordDtl_cur;
      ---- if ordDtl_cur%ISOPEN then
         open ordDtl_cur; --------------opening cursor
      --- end if;Thanks,
    Suri

  • Backup Fails with Invalid RECID Error

    Hi All,
    Please help me to understand Caution -section
    below text is from
    [http://download.oracle.com/docs/cd/B10501_01/server.920/a96566/rcmtroub.htm#447765]
    Backup Fails with Invalid RECID Error: Solution 2
    This solution is more difficult than solution 1:
    To create the control file with SQL*Plus:
       1. Connect to the target database with SQL*Plus. For example, enter:
          % sqlplus 'SYS/oracle@trgt AS SYSDBA'
       2. Mount the database if it is not already mounted:
          SQL> ALTER DATABASE MOUNT;
       3. Back up the control file to a trace file:
          SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
       4. Edit the trace file as necessary. The relevant section of the trace file looks something like the following:
          # The following commands will create a new control file and use it
          # to open the database.
          # Data used by the recovery manager will be lost. Additional logs may
          # be required for media recovery of offline data files. Use this
          # only if the current version of all online logs are available.
          STARTUP NOMOUNT
          CREATE CONTROLFILE REUSE DATABASE "TRGT" NORESETLOGS  ARCHIVELOG
          --  STANDBY DATABASE CLUSTER CONSISTENT AND UNPROTECTED
              MAXLOGFILES 32
              MAXLOGMEMBERS 2
              MAXDATAFILES 32
              MAXINSTANCES 1
              MAXLOGHISTORY 226
          LOGFILE
            GROUP 1 '/oracle/oradata/trgt/redo01.log'  SIZE 25M,
            GROUP 2 '/oracle/oradata/trgt/redo02.log'  SIZE 25M,
            GROUP 3 '/oracle/oradata/trgt/redo03.log'  SIZE 500K
          -- STANDBY LOGFILE
          DATAFILE
            '/oracle/oradata/trgt/system01.dbf',
            '/oracle/oradata/trgt/undotbs01.dbf',
            '/oracle/oradata/trgt/cwmlite01.dbf',
            '/oracle/oradata/trgt/drsys01.dbf',
            '/oracle/oradata/trgt/example01.dbf',
            '/oracle/oradata/trgt/indx01.dbf',
            '/oracle/oradata/trgt/tools01.dbf',
            '/oracle/oradata/trgt/users01.dbf'
          CHARACTER SET WE8DEC
          # Take files offline to match current control file.
          ALTER DATABASE DATAFILE '/oracle/oradata/trgt/tools01.dbf' OFFLINE;
          ALTER DATABASE DATAFILE '/oracle/oradata/trgt/users01.dbf' OFFLINE;
          # Configure RMAN configuration record 1
          VARIABLE RECNO NUMBER;
          EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CHANNEL','DEVICE TYPE DISK
          DEBUG 255');
          # Recovery is required if any of the datafiles are restored backups,
          # or if the last shutdown was not normal or immediate.
          RECOVER DATABASE
          # All logs need archiving and a log switch is needed.
          ALTER SYSTEM ARCHIVE LOG ALL;
          # Database can now be opened normally.
          ALTER DATABASE OPEN;
          # Commands to add tempfiles to temporary tablespaces.
          # Online tempfiles have complete space information.
          # Other tempfiles may require adjustment.
          ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/oradata/trgt/temp01.dbf' REUSE;
          # End of tempfile additions.
       5. Shut down the database:
          SHUTDOWN IMMEDIATE
       6. Execute the script to create the control file, recover (if necessary), archive the logs, and open the database:
          STARTUP NOMOUNT
          CREATE CONTROLFILE ...;
          EXECUTE ...;
          RECOVER DATABASE
          ALTER SYSTEM ARCHIVE LOG CURRENT;
          ALTER DATABASE OPEN ...;
    Caution:
          If you do not open with the RESETLOGS option,
    then two copies of an archived redo log for a given log sequence number may
    exist--even though these two copies have completely different contents.
    For example, one log may have been created on the original host and the other on the new host.
    If you accidentally confuse the logs during a media recovery,
    then the database will be corrupted but Oracle and RMAN cannot detect the problem.

    Please help me to understand Caution -section
    Caution:
    If you do not open with the RESETLOGS option,
    then two copies of an archived redo log for a given log sequence number may
    exist--even though these two copies have completely different contents.
    For example, one log may have been created on the original host and the other on the new host.
    If you accidentally confuse the logs during a media recovery,
    then the database will be corrupted but Oracle and RMAN cannot detect the problem.As per my understanding it says. If you don't open database with RESETLOGS option then there may be archived logs with log sequence number which is already archived on the source host. This may happen due to difference in RECIDs. Now when the database needs media recovery for this particular log sequence, you may provide any of them. So in this case, RMAN and Oracle will not be able to differentiate the two files and can accept any of the archived log files during recovery. Since the contents of two archived logs are different, because they are generated at different times and they contains different transactions. So, internally it corrupts your database.
    Rgds.

  • Invalid Cursor error when modifying Assignment details - Transfer workflow

    Hi,
    We're trying to submit a Transfer transaction but if we try to modify any field in the Assignment details screen, we're getting a system error, and sometimes we see ORA-01001: invalid cursor error. We have already checked the database objects (procedures, packages, triggers) and we don't see any code which has an invalid use of a cursor. Does anyone have a clue on the cause of this error?

    This is just a guess,
    all you cursors are being opened regardless of any condition, for example;
    OPEN CUT(:NEW.LAYOUT_NO);
    OPEN DET(:NEW.LAYOUT_NO);
    OPEN ITM(:NEW.LAYOUT_NO);
    OPEN LOT(:NEW.LAYOUT_NO);
    OPEN DTN(:NEW.LAYOUT_NO, :NEW.CUT_NO, :NEW.NOTE);UNA however is opened after a condition;
    IF DTN%NOTFOUND THEN
      /** start --added for cha 2011-3172 6/14/2011 **/
          OPEN UNA(:NEW.LAYOUT_NO, :NEW.ACCOUNT_NO);All cursors arel however closed regardless, i.e. they are all assumes to be open;
      CLOSE CUT;
      CLOSE DET;
      CLOSE DTN;
      CLOSE ITM;
      CLOSE LOT;
      CLOSE STAT;
      CLOSE UNA;So I think you are closing the UNA cursors wen it is in fact not open.
    So, move the "CLOSE UNA;" line of code to before the END IF; on line 278, since that is when it will definitely be open.

  • Getting Invalid Cursor error in a procedure

    Hi,
    I have a procedure(1) which inturn calls another procedure(2) which does some task.
    Procedure(1) accepts response from Procedure(2).
    The error code of procedure(2) is *0* which is the success response.
    Iam getting 0 from Procedure(2).
    But still Procedure(1) gives me a Invalid cursor error ( eventhough all the cursors are closed and opened ).
    Any suggestion on this????

    procedure p_create_conn -- Procedure(1) which is the calling proc
    is
    begin
    connectivity_api.p_create_connection -- Procedure(2) called proc
    in_scheme_number => in_scheme_number
    ,in_a_lp_sysid => in_a_lp_sysid
    ,in_z_lp_sysid => in_z_lp_sysid
    ,in_interconnect_name => in_interconnect_name
    ,in_mux_usage => in_mux_usage
    ,in_mux_type => in_mux_type
    ,out_a_end_sne => v_out_a_sne_id
    ,out_z_end_sne => v_out_z_sne_id
    ,out_sss_id => v_out_sss_id
    ,out_error_code => out_error_code
    ,out_error_message => out_error_message
    ,in_a_port_name => in_a_port_name
    ,in_a_port_signal => in_a_port_signal
    ,in_z_port_name => in_z_port_name
    ,in_z_port_signal => in_z_port_signal
    ,in_trs_area => in_trs_area
    ,in_alternate_id => in_alternate_id
    ,in_dcn_equipment_name => in_dcn_equipment_name
    ,in_dcn_equipment_id => in_dcn_equipment_id
    ,in_dcn_equipment_notes => in_dcn_equipment_notes
    ,in_tcode => in_tcode
    if out_error_code != 0 --- Error code from Procedure(2) is 0 in my case
    then
    raise ex_p_create_connection;
    end if;
    -- Faliing after success response here
    workflow_utils.create_link
    in_link_type => 'A'
    ,in_source_workflow_name => con_wf_scheme_type
    ,in_source_record_id => in_scheme_number
    ,in_trigger_state => 'initial'
    ,in_dest_workflow_name => con_wf_connectivity
    ,in_dest_record_id => v_out_sss_id
    ,in_dest_from_state => null
    ,in_dest_to_state => null
    ,in_terminate_source => 'N'
    ,in_terminate_dest => 'N'
    ,in_user_account_name => v_user
    -- in this proc all the cursors have been closed properly.
    exception
    when ex_p_create_connection
    then
    null;
    when others
    then
    out_error_code := sqlcode;
    out_error_message := sqlerrm;
    end p_create_connection;
    Is that fine with you????

  • Invalid Cursor Error

    I have a table called cdd_merge_children where the comments field contains the following SQL.
    SELECT EVENT_ID FROM EVENT WHERE ACCOUNT_ID = :ACCOUNT_NO
    In my procedure I am doing the following:
    --get the comments from the cdd_merge_children table where CDD_MERGE_CHILDREN_TYPE
    --is of type 3. type 3 are a replica of type 2's for audit/history purposes 
    SELECT DISTINCT COMMENTS
    INTO ls_comments
    FROM CDD_MERGE_CHILDREN
    where table_name = ps_tablename
    and CDD_MERGE_CHILDREN_TYPE = 3 ;
    --get the comments from the table and execute the dynamic sql using the looser.
    OPEN col_cv FOR ls_comments USING gvloosingaccount ;
    --dump the curosr values in the table
    FETCH col_cv BULK COLLECT INTO loosingvals ;
    For some reason or the other when I try doing the fetch I am getting invalid cursor or ORA-01001: invalid cursor error. WHY WHY
    Please help !

    You cannot bulk-fetch from a cursor into a collection of records, you can only bulk-fetch from a cursor into one or
    more collections:
    DECLARE
    TYPE NameList IS TABLE OF emp.ename%TYPE;
    TYPE SalList IS TABLE OF emp.sal%TYPE;
    CURSOR c1 IS SELECT ename, sal FROM emp WHERE sal > 1000;
    names NameList;
    sals SalList;
    BEGIN
    OPEN c1;
    FETCH c1 BULK COLLECT INTO names, sals;
    END;
    You cannot however,
    DECLARE
    TYPE NameList IS TABLE OF emp.ename%TYPE;
    names NameList;
    salary emp.sal%TYPE;
    TYPE DeptRecTab IS TABLE OF dept%ROWTYPE;
    dept_recs DeptRecTab;
    CURSOR c1 IS
    SELECT deptno, dname, loc FROM dept WHERE deptno > 10;
    BEGIN
    SELECT ename, sal BULK COLLECT INTO names, salary; -- illegal target
    BEGIN
    OPEN c1;
    FETCH c1 BULK COLLECT INTO dept_recs; -- illegal
    END;
    Ok I have a table called cdd_merge_children which has a column called comments. In this column I am storing dynamic SQL such as
    SELECT EVENT_ID FROM EVENT WHERE ACCOUNT_ID = :ACCOUNT_NO
    Now in my code I retrieve this SQL statement and use it as follows:
    --get the comments from the table and execute the dynamic sql using the looser.
    OPEN col_cv FOR ls_comments USING gvloosingaccount ;
    --col_cv is a reference cursor BTW
    --dump the curosr values in the table
    FETCH col_cv BULK COLLECT INTO loosingvals ;
    Ok at this fetch is where I am getting the following error
    ORA-01001: invalid cursor
    Why ? Anyhelp would be great
    Thank's
    Sameer Handa

  • "ORA-01001 Invalid Cursor" error

    Platform: oracle 8.X on ibm aix and java client code from
    windows NT.
    JDBC DRIVER: JDBC Oracle thin driver version 1.2.
    when i execute a Sql satement with Cursor expression from the
    java client code with XSU it returns an XML DOM But if the
    CURSOR EXPRESSION IN THE SQL QUERY RETURNS EMPTY ROWS i get
    back an error node with "ORA-01001 Invalid Cursor" error
    message.i had aslo set the setNullAttributes(true) property
    on oraclexmlquery.
    Interestingly, if i exceute the same query in the SQL plus
    it returns the column names with no rows.
    is there any way where i can get xml document with table
    structure, when there are no rows instead of ORA error message.
         

    This is just a guess,
    all you cursors are being opened regardless of any condition, for example;
    OPEN CUT(:NEW.LAYOUT_NO);
    OPEN DET(:NEW.LAYOUT_NO);
    OPEN ITM(:NEW.LAYOUT_NO);
    OPEN LOT(:NEW.LAYOUT_NO);
    OPEN DTN(:NEW.LAYOUT_NO, :NEW.CUT_NO, :NEW.NOTE);UNA however is opened after a condition;
    IF DTN%NOTFOUND THEN
      /** start --added for cha 2011-3172 6/14/2011 **/
          OPEN UNA(:NEW.LAYOUT_NO, :NEW.ACCOUNT_NO);All cursors arel however closed regardless, i.e. they are all assumes to be open;
      CLOSE CUT;
      CLOSE DET;
      CLOSE DTN;
      CLOSE ITM;
      CLOSE LOT;
      CLOSE STAT;
      CLOSE UNA;So I think you are closing the UNA cursors wen it is in fact not open.
    So, move the "CLOSE UNA;" line of code to before the END IF; on line 278, since that is when it will definitely be open.

  • Need help with **** Invalid Cursor State ****

    Hi,
    can someone tell me why am i getting this error....
    //******java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    Any help is greatly appreciated.....
    Thanks in advance.
    //***********this is the output on servlet side**************//
    Starting service Tomcat-Standalone
    Apache Tomcat/4.0.3
    Starting service Tomcat-Apache
    Apache Tomcat/4.0.3
    init
    DBServlet init: Start
    DataAccessor init: Start
    Accessor init: Loading Database Driver: sun.jdbc.odbc.JdbcOdbcDriver
    DataAccessor init: Getting a connection to - jdbc:odbc:SCANODBC
    username SYSDBA
    password masterkey
    DataAccessor init: Preparing searchPolicy
    DataAccessor init: Prepared policySearch
    DataAccessor init: Prepared ssnSearch
    DataAccessor init: End
    After the myDataAccessor
    Database Connection...
    in doGet(...)
    SSSSSSSGetpolicynumber
    In GetPolicyInformation
    b05015195
    Getting Policy Informaton for = b05015195
    okay, building vector for policy
    in GetPolicyInformation for = b05015195
    starting query... policy Information
    finishing query... Policy Information
    Inside the while(next) loop
    sun.jdbc.odbc.JdbcOdbcResultSet@4db06e
    sun.jdbc.odbc.JdbcOdbcResultSet@4db06e
    b05015195
    policy information constructor with resultset
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3266)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:
    5398)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:326)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:383)
    at viewscreenappletservlet.policyinformation.<init>(policyinformation.ja
    va:56)
    at viewscreenappletservlet.DatabaseAccessor.getPolicyInformation(Databas
    eAccessor.java:145)
    at viewscreenappletservlet.Servlet.policyDisplay(Servlet.java:108)
    at viewscreenappletservlet.Servlet.doGet(Servlet.java:91)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
    et.java:446)
    at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java
    :180)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
    torBase.java:475)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
    2343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
    rValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
    468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
    r.java:1012)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
    va:1107)
    at java.lang.Thread.run(Thread.java:484)
    result set closed
    1
    sending response
    Sending policy vector to applet...
    Data transmission complete.

    1) JDBC-ODBC driver is buggy
    2) Some drivers (truly speaking most of them) doesn't
    support cursors or supports them in a wrong way
    Paul

  • Oracle 10g EE Export Results in ORA-01001: invalid cursor Error

    Hi,
    I'm quite new to Oracle 10g and OCS10g. We have a crippled/corrupt SYSAUX tablespace (data file 3) which cannot be recovered using recover
    command anymore. So metalink support instructed us to do a export of the metadata of the working tablespace which contains our system data (we are in configuration stage for OCS 10g 10.1.2) via transportable tablespaces so that I can just recreate the database in DBCA and import the metadata. So after I made a cold backup, set the "transportable" tablespaces to "READ ONLY" mode, I proceeded w/ the export command which resulted in an error, please see below:
    $exp \'sys/********@ocs10gSID as sysdba\' parfile=transport.par
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.4.2 -
    Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    Export done in US7ASCII character set and AL16UTF16 NCHAR character set
    server uses AL32UTF8 character set (possible charset conversion)
    Note: table data (rows) will not be exported
    About to export transportable tablespace metadata...
    EXP-00008: ORACLE error 1001 encountered
    ORA-01001: invalid cursor
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 899
    ORA-06512: at "SYS.DBMS_SQL", line 19
    ORA-06512: at "SYS.DBMS_TTS", line 811
    ORA-00376: file 3 cannot be read at this time
    ORA-01110: data file 3: '/ocfs/oradata/OCS/datafile/o1_mf_sysaux_2mgzbr51_.dbf'
    ORA-06512: at "SYS.DBMS_PLUGTS", line 1444
    ORA-06512: at line 1
    Anyone encountered this problem before? Any recommendations or tips to get this working?
    I checked this url:"http://luhartma.blogspot.com/2006/05/how-to-check-if-tablespace-is.html"
    And when I try to follow the instructions and check on of the tablespace I set to and verified to be in "READ ONLY" mode, I get the same error.
    SQL> connect / as sysdba
    Connected.
    SQL> exec dbms_tts.TRANSPORT_SET_CHECK('PORTAL',TRUE)
    BEGIN dbms_tts.TRANSPORT_SET_CHECK('PORTAL',TRUE); END;
    ERROR at line 1:
    ORA-01001: invalid cursor
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 899
    ORA-06512: at "SYS.DBMS_SQL", line 19
    ORA-06512: at "SYS.DBMS_TTS", line 811
    ORA-00376: file 3 cannot be read at this time
    ORA-01110: data file 3: '/ocfs/oradata/OCS/datafile/o1_mf_sysaux_2mgzbr51_.dbf'
    ORA-06512: at "SYS.DBMS_TTS", line 840
    ORA-06512: at line 1
    Hope someone can help on this or at least provide a suggestion. Data file 3 above is the reason we are doing a transportable tablespace export & db recreation.
    BTW what we have is:
    OCS 10g 10.1.2 w/ Oracle RDBMS 10g Enterprise Edition 10.1.0.4.2
    RHEL4 Update2
    Thanks in advance.
    Regards,
    -Kenth

    Hi,
    The status is "RECOVER" we have actually tried to recover but unfortunately the archive logs that were needed were on disks and were lost during one of the server hardware failures. Actually that is the reason why metalink support recommended this route for getting everything in order since we don't have any application data in SYSAUX yet.
    Thanks.

  • Getting Invalid Cursor Error

    Hi, I am having trouble with my code and it is generating an error in the alert logs and trace files. Can i ask for help?
    Fri Sep 02 19:20:33 2011
    Errors in file D:\oracle\dumps\prod_ora_5312.trc:
    ORA-00600: internal error code, arguments: [17281], [1001], [0x680CAB34], [], [], [], [], []
    ORA-01001: invalid cursor
    The trace file says:
    TraceFiles:
    Oracle process number: 20
    Windows thread id: 5312, image: ORACLE.EXE (SHAD)
    *** SERVICE NAME:(PROD) 2011-09-02 10:43:22.592
    *** SESSION ID:(133.14370) 2011-09-02 10:43:22.592
    *** 2011-09-02 10:43:22.592
    ksedmp: internal or fatal error
    ORA-00600: internal error code, arguments: [17281], [1001], [0x680CAB34], [], [], [], [], []
    ORA-01001: invalid cursor
    Current SQL statement for this session:
    declare  cursor NlsParamsCursor is    SELECT FROM nls_session_parameters;begin SELECT Nvl(Lengthb(Chr(65536)), Nvl(Lengthb(Chr(256)), 1)) INTO :CharLength FROM dual; for NlsRecord in NlsParamsCursor loop if NlsRecord.parameter = 'NLS_DATE_LANGUAGE' then :NlsDateLanguage := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_DATE_FORMAT' then :NlsDateFormat := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_NUMERIC_CHARACTERS' then :NlsNumericCharacters := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_TIMESTAMP_FORMAT' then :NlsTimeStampFormat := NlsRecord.value; elsif NlsRecord.parameter = 'NLS_TIMESTAMP_TZ_FORMAT' then :NlsTimeStampTZFormat := NlsRecord.value; end if; end loop;end;*
    What is wrong with this code and how can i resolve this? Thanks!
    Edited by: gab-gab on Sep 2, 2011 7:36 PM

    maybe (bind variables :CharLength etc. belong to SQL not PL/SQL)
    declare
      cursor NlsParamsCursor is SELECT * FROM nls_session_parameters;
      CharLength number;
      NlsDateLanguage varchar2(40);
      NlsDateFormat varchar2(40);
      NlsNumericCharacters varchar2(40);
      NlsTimeStampFormat varchar2(40);
      NlsTimeStampTZFormat varchar2(40);
    begin
      SELECT Nvl(Lengthb(Chr(65536)), Nvl(Lengthb(Chr(256)), 1))
        INTO CharLength
        FROM dual;
      for NlsRecord in NlsParamsCursor
      loop
        if NlsRecord.parameter = 'NLS_DATE_LANGUAGE' then
          NlsDateLanguage := NlsRecord.value;
        elsif NlsRecord.parameter = 'NLS_DATE_FORMAT' then
          NlsDateFormat := NlsRecord.value;
        elsif NlsRecord.parameter = 'NLS_NUMERIC_CHARACTERS' then
          NlsNumericCharacters := NlsRecord.value;
        elsif NlsRecord.parameter = 'NLS_TIMESTAMP_FORMAT' then
          NlsTimeStampFormat := NlsRecord.value;
        elsif NlsRecord.parameter = 'NLS_TIMESTAMP_TZ_FORMAT' then
          NlsTimeStampTZFormat := NlsRecord.value;
        end if;
      end loop;
    end;Regards
    Etbin
    Edited by: Etbin on 3.9.2011 8:48
    comment about probable reason of the exception raised
    Edited by: Etbin on 4.9.2011 11:58
    or you had in mind this http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/expressions012.htm#i1033659

Maybe you are looking for