ORA-01001: invalid cursor (Inbound jdbc adapter XI 2.0)

Hello, I get the error ORA-01001: invalid cursor when I try to delete the data in interface table in an ORACLE database. Has anybody an idea of what maybe the problem.
here the text...
14:41:59 (4225): Confirm with statement "delete * from sap_interface.aswaa00f"
14:41:59 (4226): ERROR: Confirm action failed with error "java.sql.SQLException: ORA-01001: invalid cursor
regards
Ernesto Duran

Hello Prasad, thank you for your response. The problem (limitation) was that the adapter (or the driver) can only update natives ORACLE tables and the table I wanted to update was a gateway table to an external program.
regards
Ernesto Duran

Similar Messages

  • Proxy connections getting ORA-01001: invalid cursor

    All,
    I am having tremendous difficulty using Oracle proxy connections under WebSphere 5.1. The problem appears to be that the proxy sessions (or the logical connections) are not being closed properly resulting in 'invalid cursor' and 'fetch out of sequence' exceptions.
    Here's the sequence of events:
    Environment
    AppServer : Websphere 5.1
    Database : Oracle 10gR2
    Datesource: oracle.jdbc.pool.OracleConnectionPoolDataSource
    Start up application server
    Check the sessions on the db
    USERNAME                       TYPE       SERVER    MODULE
    * APAX                           USER       DEDICATED
    * APAX                           USER       DEDICATED
    SYS                            USER       DEDICATED sqlplus@apaxIIdb (TNS V1-V3)* = connection pool sessions
    Step 1: getting the connection
    // lookup datasource in jndi
    Connection myConnection = myDataSource.getConnection();Step 2: opening a proxy connection
    Properties myProperties = new Properties();
    myProperties.put("CONNECTION_TAG", aPrincipal);
    myProperties.put("PROXY_USER_NAME", aPrincipal);
    OracleConnection myOracleConnection =
      (OracleConnection) WSJdbcUtil.getNativeConnection((WSJdbcConnection) myConnection);
    myOracleConnection.openProxySession(OracleConnection.PROXYTYPE_USER_NAME, myProperties);Step 3: check the sessions on the db
    SQL>  select username, type, server, module
    from v$session
    where type != 'BACKGROUND'
    and username is not null
    order by username;
    USERNAME                       TYPE       SERVER    MODULE
    APAX                           USER       DEDICATED
    APAX                           USER       DEDICATED
    APAX                           USER       DEDICATED
    SYS                            USER       DEDICATED sqlplus@apaxIIdb (TNS V1-V3)
    * USER1                          USER       PSEUDO* = proxy connection
    Step 4: prepare and execute query
    myResultSet = myStatement.executeQuery();Exception thrown: java.sql.SQLException: ORA-01001: invalid cursor
    SQLState = 72000
    vendorCode = 1001
    Session information:
    USERNAME                       TYPE       SERVER    MODULE
    APAX                           USER       DEDICATED
    APAX                           USER       DEDICATED
    SYS                            USER       DEDICATED sqlplus@apaxIIdb (TNS V1-V3)
    * USER1                          USER       DEDICATED* = proxy session appears to have changed
    Step 5: clear up
    OracleConnection myOracleConnection =
      (OracleConnection) WSJdbcUtil.getNativeConnection((WSJdbcConnection) aConnection);
    myOracleConnection.close(OracleConnection.PROXY_SESSION);
    myOracleConnection.close();Check sessions again
    USERNAME                       TYPE       SERVER    MODULE
    APAX                           USER       DEDICATED
    APAX                           USER       DEDICATED
    SYS                            USER       DEDICATED sqlplus@apaxIIdb (TNS V1-V3)There are no Oracle udump files or other tracing information.
    Any ideas?

    We were getting ORA-01001 error messages that didn't appear to make sense when calling certain pl/sql procedures from a application running on a Weblogic/Apache platform. The errors would not occur when we invoked the same procedures via script from a standalone SQL client.
    We were able to put an end to the Web application errors by upgrading our jdbc driver from 10.1.0.4.0 to 10.2.0.1.0.

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

  • ORA-01001: invalid cursor

    I have the below code I am trying to execute and get the error ORA-01001: invalid cursor
    create or replace PROCEDURE TESTUPDATE(pNAME VARCHAR2,pID NUMBER) IS
      CN NUMBER;
       CURSOR C1 IS
       SELECT CODE,SOPTION,SFILE
              STREET1,
              STREET2
       FROM TABLE1
       WHERE CODE = '10';
       CURSOR C2 IS
       SELECT CODE,
              STREET1,
              STREET2
       FROM TABLE2
        WHERE CODE = '10;
        C1_REC C1%rowtype;
        C2_REC C2%rowtype;
    BEGIN
       OPEN C1;
       FETCH C1 INTO C1_REC;
       SELECT COUNT(*) INTO CN FROM TABLE2
       WHERE  code =  '10'
          IF ( C1_REC.SOPTION = 'C' )  THEN  --- SOPTION is 'C"
             IF (CN = 0) THEN 
                IF (C1_REC.SFILE = 'FILE') THEN
                   INSERT INTO TABLE2(ASSIGNED) VALUES('Y');
                    ELSE    
                   INSERT INTO TABLE2(ASSIGNED) VALUES('N');              
                END IF;   
             ELSE    /* CN > 0 */
               OPEN C2;
               FETCH C2 INTO C2_REC;
               IF (C1_REC.SFILE = 'FILE') THEN
                 IF ( C1_REC.STREET1 IS NOT NULL OR
                     C1_REC.STREET2 IS NOT NULL ) AND
                   ( C1_REC.STREET1 !=  C2_REC.STREET1 OR
                     C1_REC.STREET2 !=  C2_REC.STREET2) THEN
                  UPDATE TABLE2
                  SET    ASSIGNED = 'I';
                 END IF;
           ELSE  /*IS NOT EQUAL TO 'FILE'*/
                 IF ( C1_REC.STREET1 IS NOT NULL OR
                     C1_REC.STREET2 IS NOT NULL ) AND
                   ( C1_REC.STREET1 !=  C2_REC.STREET2 OR
                     C1_REC.STREET2 !=  C2_REC.STREET2) THEN
                  UPDATE TABLE2
                  SET    TABLE2_status_ind = 'N';
               END IF;
             END IF;
           END IF;
          ELSIF ( C1_REC.SOPTION = 'CR' ) THEN   /*SOPTION is 'CR"*/
             IF (CN = 0) THEN
                IF (C1_REC.SFILE = 'FILE') THEN
                   INSERT INTO TABLE2(ASSIGNED) VALUES('Y');
                    ELSE    
                   INSERT INTO TABLE2(ASSIGNED) VALUES('N'); 
                END IF;
         ELSE    /* CN > 0*/
               OPEN C2;
               FETCH C2 INTO C2_REC; 
               IF (C1_REC.SFILE = 'FILE') THEN
                 IF ( C1_REC.STREET1 IS NOT NULL OR
                     C1_REC.STREET2 IS NOT NULL ) AND
                   ( C1_REC.STREET1 !=  C2_REC.STREET2 OR
                     C1_REC.STREET2 !=  C2_REC.STREET2) THEN
                  UPDATE TABLE2
                  SET    TABLE2_status_ind = 'I';
                  END IF;             
            ELSE  /* IS NOT EQUAL TO 'FILE'*/
                 IF ( C1_REC.STREET1 IS NOT NULL OR
                     C1_REC.STREET2 IS NOT NULL ) AND
                   ( C1_REC.STREET1 !=  C2_REC.STREET2 OR
                     C1_REC.STREET2 !=  C2_REC.STREET2) THEN
                  UPDATE TABLE2
                  SET    TABLE2_status_ind = 'I';
                  END IF; 
           END IF;
         END IF;
    END IF;
    CLOSE C1;
    CLOSE C2;     
    END IF;
    EXCEPTION WHEN NO_DATA_FOUND THEN
                       dbms_output.put_line('e1');
      CLOSE C1;
    WHEN OTHERS THEN
            CLOSE C1;
            dbms_output.put_line('e2');
    END;when I have the soption as CR and cn=0, I get the error invalid cursor. Please help me with changes to the code to overcome this error
    thanks
    Edited by: 890563 on 14 Nov, 2012 5:37 AM
    Edited by: BluShadow on 14-Nov-2012 13:39
    added {noformat}{noformat} tags to make code readable.  After 48 questions (of which you still have 40 unanswered for some reason?) and a year on the forums, we would expect you to have learnt how to ask questions... but just in case you missed it... read here: {message:id=9360002}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I am sorry for posting such confusing code. I changed the last part of code code to
    END IF;
    END IF;
    CLOSE C1;
    CLOSE C2;
    END IF;
    END IF;
    EXCEPTION WHEN NO_DATA_FOUND THEN
    dbms_output.put_line('e1');
    CLOSE C1;
    WHEN OTHERS THEN
    CLOSE C1;
    dbms_output.put_line('e2');
    END;
    and it worked with out errors
    Thanks

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

  • Unexpected "ORA-01001: invalid cursor" error

    I have a Pro*C application that basically fetches from a cursor, does a bunch of work with that row, does a "delete from <table> where current of <cursor name>", then loops back, fetches, the next row, etc., and finally closes the cursor once all the rows have been processed.
    One of our clients is getting an 'ORA-01001' error on the "DELETE FROM <table> WHERE CURRENT OF <cursor>" statement. This is long-standing, frequently executed code at 100+ clients and I've never had a problem with this statement before. The client is consistently getting this error on a particular row from this cursor, but other rows processed with the same cursor are processing successfully.
    Unfortunately, I do not have direct access to the client's database, so I cannot debug directly, but I've placed print statements around the only place in my application's code that explicitly closes the cursor. A log generated on a run that threw the 1001 error confirmed that the cursor is NOT being explicitly closed by my application by an "EXEC SQL CLOSE <cursor>" statement.
    Likewise, I put print statements around all the COMMITs and ROLLBACKs in my application, and none of these showed in the logs either.
    My application does make a call to a client-customized PL/SQL function that they recently changed. However, I have a copy of the clients function and there are not any explicit COMMIT, ROLLBACK, ANALYZE, ALTER, DROP, REPLACE, TRUNCATE or CREATE statements that would implicitly commit and close the cursor.
    Here are potential problems that I have ruled out:
    -Oracle OPEN_CURSORS parameter - It appears that if this were the problem, the error would be an ORA-1000, not 1001. Please correct me if I am wrong here.
    -Pro*C MAXOPENCURSORS parameter - I compiled a version with a MAXOPENCURSORS value that is higher than the client's OPEN_CURSORS setting. If this were the problem, the error should have switched to the ORA-1000 error when I increased the parameter. It remained as an ORA-1001.
    Next steps:
    -What could cause a cursor to close other than explicit COMMIT, ROLLBACK, ANALYZE, ALTER, DROP, REPLACE, TRUNCATE or CREATE statements?
    -Is there anything I can run, such as a database trace, that will show me exactly when the cursor is being closed? I admittedly don't know a lot about DB traces.
    -Anything else I should check? Any other information I should provide?
    Thanks ahead of time for any help!

    Chandrakaanth Ramamurthy wrote:
    Does the client customized PL/SQL block contain EXIT
    Exit will end up issuing a commit and hence this could be an issue.Exit is not used in the customized function.
    Chandrakaanth Ramamurthy wrote:
    Also please check that commit and roll back are placed at the end of the loop.The only commit/rollback is after the loop is over is finished.
    I actually just figured out the issue. Turns out the cursor just hadn't been opened due to a very unique data condition... facepalm You know what happens when you assume things, right? :)
    Thanks for the help anyway!

  • Getting ORA-01001: invalid cursor when I try to parse my SQL statement with DBMS_SQL

    -- To modify this template, edit file PROC.TXT in TEMPLATE
    -- directory of SQL Navigator
    -- Purpose: Briefly explain the functionality of the procedure
    -- MODIFICATION HISTORY
    -- Person Date Comments
    TYPE column_find IS VARRAY(999) of VARCHAR2(4);
    v_client_column varchar2(4);
    v_errorcode NUMBER;
    v_errortext VARCHAR2(200);
    i number :=0;
    V_COLUMN_NAME varchar2(20);
    V_COLUMN_NAME2 varchar2(20);
    v_SQL_STMT varchar2(2000);
    v_c_hndl integer;
    v_Client_ID varchar2(200);
    column_name varchar2(20);
    execute_feedback integer;
    mal material_attribute_pre_load%
    ROWTYPE;
    local_var varchar2(200);
    clienttab DBMS_SQL.DATE_TABLE;
    client_column column_find := column_find();
    -- Declare program variables as shown above
    BEGIN
    --client_column := column_find();
    v_c_hndl := DBMS_SQL.OPEN_CURSOR;
    while i < 999
    LOOP
    i := i + 1;
    client_column.EXTEND;
    client_column(i) := CONCAT('c',i);
    dbms_output.put_line(client_column(i));
    BEGIN
    dbms_output.put_line('Starting SQL_STMT.');
    v_SQL_STMT := 'SELECT :column_name FROM
    MATERIAL_ATTRIBUTE_PRE_LOAD WHERE :column_name2 = :v_Client_ID';
    dbms_output.put_line('Starting DBMS_SQL.PARSE.');
    DBMS_SQL.PARSE(v_c_hndl,v_SQL_STMT,DBMS_SQL.NATIVE);
    dbms_output.put_line('Starting DBMS_SQL.BIND_VARIABLE.');
    DBMS_SQL.BIND_VARIABLE
    (v_c_hndl,'v_Client_ID','Client ID');
    DBMS_SQL.BIND_VARIABLE
    (v_c_hndl,'column_name',client_column(i));
    DBMS_SQL.BIND_VARIABLE
    (v_c_hndl,'column_name2',client_column(i));
    dbms_output.put_line('Starting DBMS_SQL.DEFINE_ARRAY.');
    DBMS_SQL.DEFINE_ARRAY(v_c_hndl,1,clienttab,999,1);
    execute_feedback := DBMS_SQL.EXECUTE_AND_FETCH
    (v_c_hndl);
    DBMS_SQL.CLOSE_CURSOR(v_c_hndl);
    dbms_output.put_line
    EXCEPTION
    WHEN OTHERS THEN
    v_errorcode := SQLCODE;
    v_errortext := SUBSTR(SQLERRM,1,200);
    dbms_output.put_line('DISPLAY_ERROR'||SUBSTR(TO_CHAR
    (v_errorcode)||v_errortext,1,30));
    END;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    v_errorcode := SQLCODE;
    v_errortext := SUBSTR(SQLERRM,1,200);
    dbms_output.put_line('DISPLAY_ERROR'||SUBSTR(TO_CHAR
    (v_errorcode)||v_errortext,1,30));
    END; -- Procedure COLUMN_FIND

    I'm using Oracle Database Express edition (latest version from the website afaik), logging into the web interface (using unique account I created after setup[not System], gave it All rights), clicking on SQL > SQL Commands > Enter commands.
    I can't run each insert individually, that is only 1 table out of 8 tables, and I probably need to be able to run the entire script (which is actually headed by a sequence of Drop Table commands) sometimes, to refresh the data back to original values in case I stuff things up. The code was originally provided in a text file called bookscript.sql, but I haven't had any success importing or uploading that file into Oracle XE, if I use SQL > SQL Scripts > Upload, the file uploads, I then click on it and click on Run, but nothing seems to happen. (File is shared [read-only] here: https://docs.google.com/leaf?id=0B7IgBXIBNxw3OTY1ZTdmNGQtMjEwYi00YmRmLTkwZjItODZkYmYxODNkMTk4&hl=en_US).
    Would love any guidance as to how to modify my environment or how to input the code differently to get it running, it works fine in the hosted environment at Uni, it's an Oracle class (textbook is Guide to Oracle 10g). Lecturer doesn't seem to know much about setting up Oracle, only working in a functioning environment.

  • Problem in inbound JDBC Adapter

    My scenario is like sending data from SAP to database through JDBC adapter.
    but when i tried to excute my program it is giving follwing message:
    Error processing request in sax parser: Error when executing statement for table/stored proc.  java.sql.SQLException: ORA-00001: unique constraint (STSC.UDT_PRICELOCZONE_CPK) violated
    i am sure there is no duplicate records.
    can anyone tell me what the problem?

    Hi Suresh,
    that message is defintly from your database. Try to execute your stored procedure in debug mode with just the same parameters as in your XML message.
    Regards,
    Udo

  • Invalid cursor problem

    Steve,
    Were you ever able to look at this item? In the meantime, my work around was to do a separate xsql query for each sub-query(cursor) and then append nodes in my DOM as I went along. But, I would like to help this tool be better. I think I have determined that if one of the sub-select/sub-cursor queries doesn't return anything, I get the "invalid cursor" error. Does that make sense to you? I think that if a the result should still be a blank node
    ( </NODE> ). What do you think?
    thanks,
    chad.
    -----Original Message-----
    From: Chad Small
    Sent: Friday, September 22, 2000 9:31 AM
    To: 'Steve Muench'
    Subject: RE: LONG data type and subsequent CURSOR's question/problem
    I attached two files:
    1. file with sql script - you'll have to change the schema.
    2. file with code. Two sections
    a. 1st with jdbc result set code
    b. 2nd with OracleXMLQuery
    I comment out one or the other code section to run one or the other.
    If you need any other information, please let me know.
    thanks,
    chad.
    -----Original Message-----
    From: Steve Muench [mailto:[email protected]]
    Sent: Thursday, September 21, 2000 4:14 PM
    To: Chad Small
    Subject: Re: LONG data type and subsequent CURSOR's question/problem
    Is it possible to send me CREATE TABLE script with one row
    of sample data inserted that reproduces the problem?
    Thanks.
    Steve Muench, Lead XML Evangelist & Consulting Product Manager
    BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    Author "Building Oracle XML Applications", O'Reilly http://www.oreilly.com/catalog/orxmlapp/
    ----- Original Message -----
    From: "Chad Small" <[email protected]>
    To: "'Steve Muench'" <[email protected]>
    Sent: Thursday, September 21, 2000 3:56 PM
    Subject: RE: LONG data type and subsequent CURSOR's question/problem
    |
    | Using the same query string on both programs:
    |
    | String xsqlString =
    | "SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | hwp.body, " +
    | "CURSOR( SELECT hws.name as section_name " +
    | "FROM health.section hws " +
    | "WHERE hwp.section_id = hws.section_id) as section " +
    | "FROM health.publish_document hwp " +
    | "WHERE hwp.publish_document_id IN (13729, 1033, 11695)";
    | ____________________________________________________________________________
    | ______
    | This works - simple JDBC program :
    |
    | PreparedStatement stmt = conn.prepareStatement(xsqlString);
    | ResultSet rs = stmt.executeQuery();
    |
    | int n=1;
    | while( rs.next() ) {
    | System.out.println(n+": publish_document_id =
    | "+rs.getInt("publish_document_id"));
    | System.out.println(n+": topic_id = "+rs.getInt("topic_id"));
    | System.out.println(n+": section_id = "+rs.getInt("section_id"));
    | n++;
    | }
    | rs.close();
    | stmt.close();
    | conn.close();
    | ____________________________________________________________________________
    | ______
    | This does not work - simple OracleXMLQuery:
    |
    | OracleXMLQuery qry = new OracleXMLQuery(conn, xsqlString);
    | System.out.println("after\n");
    | // structure the generated XML document
    | qry.setMaxRows(1); // set the maximum number of rows to be returned
    | qry.setStyleSheet("file:D:\\xsql\\bin\\healthwise.xsl"); // sets the
    | stylesheet
    |
    | // get the XML document in string format
    | String xmlString = qry.getXMLString();
    |
    | // print out the XML document
    | System.out.println(" OUTPUT IS:\n"+xmlString);
    | conn.close();
    | ____________________________________________________________________________
    | _______
    | -> get this:
    |
    | OUTPUT IS:
    | <?xml version = '1.0'?>
    | <ERROR>oracle.xml.sql.OracleXMLSQLException: Stream has already been
    | closed</ERROR>
    |
    |
    | java.sql.SQLException: ORA-01001: invalid cursor
    |
    | at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
    | at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    | at oracle.jdbc.ttc7.Oclose.receive(Oclose.java:126)
    | at oracle.jdbc.ttc7.TTC7Pr otocol.close(TTC7Protocol.java:493)
    | at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:467)
    | at
    | oracle.jdbc.driver.OracleConnection.close_statements(OracleConnection.java:1
    | 141)
    | at oracle.jdbc.driver.OracleConnection.close(OracleConnection.java:537)
    | at com.healthecare.search.apelon.xmlquerydb.main(xmlquerydb.java:116)
    | at symantec.tools.debug.Agent.runMain(Native Method)
    | at symantec.tools.debug.MainThread.run(Agent.java:48)
    |
    |
    | Please advise.
    |
    | thanks,
    | chad.
    | -----Original Message-----
    | From: Steve Muench [mailto:[email protected]]
    | Sent: Thursday, September 21, 2000 1:46 PM
    | To: Chad Small
    | Subject: Re: LONG data type and subsequent CURSOR's question/problem
    |
    |
    | Are you able to test the query that does cause the
    | problem with:
    |
    | -> The command-line XSU utility
    | -> A simple JDBC program that creates a prepared statement
    | with this query and executes it to produce a result set
    |
    | I want to know if the problem is in JDBC or XSU.
    |
    | ______________________________________________________________
    | Steve Muench, Lead XML Evangelist & Consulting Product Manager
    | BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    | Author "Building Oracle XML Applications", O'Reilly
    | http://www.oreilly.com/catalog/orxmlapp/
    |
    | ----- Original Message -----
    | From: "Chad Small" <[email protected]>
    | To: "'Steve Muench'" <[email protected]>
    | Sent: Thursday, September 21, 2000 1:09 PM
    | Subject: RE: LONG data type and subsequent CURSOR's question/problem
    |
    |
    | | The problem does NOT occur in (1) -simple query.
    | | And yes, the problem does occur in (2) - in combination with CURSOR.
    | |
    | | thanks,
    | | chad.
    | |
    | | -----Original Message-----
    | | From: Steve Muench [mailto:[email protected]]
    | | Sent: Thursday, September 21, 2000 11:44 AM
    | | To: Chad Small
    | | Subject: Re: LONG data type and subsequent CURSOR's question/problem
    | |
    | |
    | | Trying to isolate the problem a little...
    | |
    | | (1) Does the problem occur if you do a simple query like:
    | |
    | | SELECT body FROM table
    | |
    | | with just the LONG column?
    | |
    | | (2) Or does it only happen in combination with CURSOR() ?
    | |
    | | ______________________________________________________________
    | | Steve Muench, Lead XML Evangelist & Consulting Product Manager
    | | BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    | | Author "Building Oracle XML Applications", O'Reilly
    | | http://www.oreilly.com/catalog/orxmlapp/
    | |
    | | ----- Original Message -----
    | | From: "Chad Small" <[email protected]>
    | | To: <[email protected]>
    | | Sent: Thursday, September 21, 2000 10:24 AM
    | | Subject: LONG data type and subsequent CURSOR's question/problem
    | |
    | |
    | | | Hello Steve,
    | | |
    | | | First I want to thank-you for all of the support you put into Oracle's
    | XML
    | | | board. I just ordered your book from Fatbrain and it's on back order!
    | I
    | | | tried asking my question on the board and didn't have any luck getting
    | any
    | | | responses - maybe people didn't understand my question. I'm desperate
    | for
    | | | this to work and really need some guidance.
    | | |
    | | | I'm using the command line to extract data from tables to XML
    | | | (.bin\xsql\bin\xsql healthwise.xsql chad.xml). Everything works
    | | wonderfully
    | | | until I add a LONG data type to the mix. Here is my xsql before the
    | LONG:
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | | | CURSOR( SELECT hws.name as section_name
    | | | FROM health.section hws
    | | | WHERE hwp.section_id = hws.section_id) as section,
    | | | CURSOR( SELECT hwk.name as keyword_name
    | | | FRO M health.keyword hwk, health.map_keyword_object
    | | | hwmko, health.object hwo
    | | | WHERE (hwp.publish_document_id =
    | | | hwo.publish_document_id) and
    | | | (hwo.object_id = hwmko.object_id) and
    | | | (hwmko.keyword_id = hwk.keyword_id) ) as keywords,
    | | | CURSOR( SELECT hwt.name as topic_name,
    | | | CURSOR( SELECT hwts.name as topic_synonym_name
    | | | FROM health.topic_synonym hwts
    | | | WHERE hwt.topic_id = hwts.topic_id) as
    | | | topic_synonyms,
    | | | CURSOR( SELECT hwc.name as catagory_name
    | | | FROM health.category hwc,
    | | health.map_category_topic
    | | | hwmct
    | | | WHERE (hwt.topic_id = hwmct.topic_id) and
    | | | (hwmct.category_id = hwc.category_id) ) as catagories
    | | | FROM health.topic hwt
    | | | WHERE hwp.topic_id = hwt.topic_id) as topic
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.publish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | I'm using this in combination with a XSLT and get this output -
    | Beautiful!
    | | -
    | | | just what I want, less my LONG body field :
    | | |
    | | | <?xml version="1.0" encoding="UTF-8"?>
    | | | <CONTENT>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=10744&#38;item=7</URL>
    | | | <TITLE>Graft versus Host Disease</TITLE>
    | | | <RANK1>
    | | | <RANK1_DSCR>GVHD</RANK1_DSCR>
    | | | </RANK1>
    | | | <RANK2/>
    | | | <RANK3>
    | | | <RANK3_DSCR>Rare Disorders</RANK3_DSCR>
    | | | </RANK3>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=910&#38;item=4</URL>
    | | | <TITLE>Hypnosis</TITLE>
    | | | <RANK1/>
    | | | <RANK2>
    | | | <RANK2_DSCR>Hypnotherapy</RANK2_DSCR>
    | | | </RANK2>
    | | | <RANK3/>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=12344&#38;item=9</URL>
    | | | <TITLE>Low Back Problems -- Computerized axial tomography (CAT scan,
    | | | CT scan)</TITLE>
    | | | <RANK1>
    | | | <RANK1_DSCR>CT scan (computerized tomography),
    | | | back</RANK1_DSCR>
    | | | <RANK1_DSCR>CT scan, back</RANK1_DSCR>
    | | | <RANK1_DSCR>Back, CT scan of</RANK1_DSCR>
    | | | <RANK1_DSCR>Computed axial tomography (CAT) scan,
    | | | back</RANK1_DSCR>
    | | | </RANK1>
    | | | <RANK2/>
    | | | <RANK3/>
    | | | </CONTENT>
    | | |
    | | |
    | | | BUT, as soon as I add the LONG body field into the query (in BOLD):
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | hwp.body,
    | | | <--------- hwp.body is the LONG
    | | | CURSOR( SELECT hws.name as section_name
    | | | FROM health.section hws
    | | | WHERE hwp.section_id = hws.section_id) as section,
    | | | CURSOR( SELECT hwk.name as keyword_name
    | | | FROM health.keyword hwk, health.map_keyword_object
    | | | hwmko, health.object hwo
    | | | WHERE (hwp.publish_document_id =
    | | | hwo.publish_document_id) and
    | | | (hwo.object_id = hwmko.object_id) and
    | | | (hwmko.keyword_id = hwk.keyword_id) ) as keywords,
    | | | CURSOR( SELECT hwt.name as topic_name,
    | | | CURSOR( SELECT hwts.name as topic_synonym_name
    | | | FROM health.topic_synonym hwts
    | | | WHERE hwt.topic_id = hwts.topic_id) as
    | | | topic_synonyms,
    | | | CURSOR( SELECT hwc.name as catagory_name
    | | | FROM health.category hwc,
    | | health.map_category_topic
    | | | hwmct
    | | | WHERE (hwt.topic_id = hwmct.topic_id) and
    | | | (hwmct.category_id = hwc.category_id) ) as catagories
    | | | FROM health.topic hwt
    | | | WHERE hwp.topic_id = hwt.topic_id) as topic, hwp.body
    | | | <---------------- I tried it here too
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.pu blish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | I get this error:
    | | | oracle.xml.sql.OracleXMLSQLException: Stream has already been closed
    | | |
    | | |
    | | | However, this works:
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id, hwp.body
    | | | <--------- hwp.body is the LONG
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.publish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | Do I have to pull this out into code and stream the long into a string
    | and
    | | | build a DOM and then go to XML from that? Or something along those
    | lines?
    | | | And if this is the case, can you point me to some sample code.
    | | | I don't have the option of changing the LONG to something that doesn't
    | | have
    | | | to be streamed as suggested in this
    | | |
    | |
    | doc(http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/basic4.htm).
    | | |
    | | |
    | | | If we can come to a conclusion on this, I will be the xsql-long
    | evangelist
    | | | on the board!
    | | |
    | | | Thank-you for you time,
    | | | chad. <[email protected]>
    | | |
    | | |
    | |
    |
    null

    Just wanted to post Steve's response to this question, in case others have problems with LONG data types and CURSORS in their .xsql queries (thanks Steve!):
    I can reproduce the problem with your testcase.
    I've filed Bug Number 1472008.
    You can workaround the problem by using CLOB
    instead of LONG in your table.
    You can use to TO_LOB() function in a CREATE TABLE...AS SELECT...
    or in an INSERT INTO TABLE...SELECT... to easily
    convert existing LONG content into CLOBs.
    null

  • Payables Open Interface Purge completes with error "Invalid Cursor"

    Hello,
    I'm trying to run Payables Open Interface Purge (version 115.8) and get an invalid cursor error in the beforereport trigger. Does anyone know the cause and remedy of this? A portion of the log is below. I've looked at the cursor and everything looks fine to me.
    MSG-00001: (Import_purge 1) Check control table for the purge process
    MSG-00001: (Check_control_table 1) Lock the control table
    MSG-00003: (Check_control_table 2) Fetch import_requests
    MSG-00004: (Check_control_table 3) Check concurrent program status
    MSG-00999: FUNCTION GET_REQUEST_STATUS ERROR, Reason:
    MSG-00999: FND_CONCURRENT.GET_REQUEST_STATUS<-Check_control_table<-Import_purge<- Before report trigger <- APXIIPRG
    MSG-00999: check_control_table<-Import_purge<- Before report trigger <- APXIIPRG
    MSG-00999: (Import_purge 1) Check control table for the purge process
    MSG-00999: Delete record in control table..
    MSG-00999: ORA-01001: invalid cursor
    REP-1419: 'beforereport': PL/SQL program aborted.
    Thank you.

    I'm trying to run Payables Open Interface Purge (version 115.8) and get an invalid cursor error in the beforereport trigger. Does anyone know the cause and remedy of this? A portion of the log is below. I've looked at the cursor and everything looks fine to me.
    MSG-00001: (Import_purge 1) Check control table for the purge process
    MSG-00001: (Check_control_table 1) Lock the control table
    MSG-00003: (Check_control_table 2) Fetch import_requests
    MSG-00004: (Check_control_table 3) Check concurrent program status
    MSG-00999: FUNCTION GET_REQUEST_STATUS ERROR, Reason:
    MSG-00999: FND_CONCURRENT.GET_REQUEST_STATUS<-Check_control_table<-Import_purge<- Before report trigger <- APXIIPRG
    MSG-00999: check_control_table<-Import_purge<- Before report trigger <- APXIIPRG
    MSG-00999: (Import_purge 1) Check control table for the purge process
    MSG-00999: Delete record in control table..
    MSG-00999: ORA-01001: invalid cursor
    REP-1419: 'beforereport': PL/SQL program aborted.11i: Payables Open Interface Invoice Import Troubleshooting Guide (APXIIMPT) [ID 107628.1] -- 3. Open Interface Import Purge Fails with ORA-01001: Invalid Cursor
    Thanks,
    Hussein

  • Invalid Cursor

    From Last 4 hours I am trying to resolve below issue.
    Please Please.......Please Help me out.
    Not getting that what is the problem ???? every thing is alright, why the error is comming on different database.
    SQL*Plus: Release 10.1.0.2.0 - Production on Wed Jul 25 11:57:49 2007
    Copyright (c) 1982, 2004, Oracle.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning and OLAP options
    JServer Release 9.2.0.6.0 - Production
    SQL>  select * from v$version
      2  /
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE    9.2.0.6.0       Production
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    SQL>
    SQL> SELECT * FROM GLOBAL_NAME
      2  /
    GLOBAL_NAME
    PNRDPD
    SQL>
    SQL> CREATE OR REPLACE PACKAGE ORAPDEV_PKG IS
      2  PROCEDURE DUAL_DATA(P_DEPTNO IN NUMBER, RESULTSET IN OUT SYS_REFCURSOR);
      3  END ORAPDEV_PKG;
      4  /
    Package created.
    SQL>
    SQL>
    SQL>  CREATE OR REPLACE PACKAGE BODY ORAPDEV_PKG IS
      2   PROCEDURE DUAL_DATA(P_DEPTNO IN NUMBER, RESULTSET IN OUT SYS_REFCURSOR) IS
      3    BEGIN
      4    OPEN RESULTSET FOR 'SELECT EMPNO FROM SCOTT.EMP WHERE DEPTNO = '||P_DEPTNO;
      5    END;
      6   END ORAPDEV_PKG;
      7  /
    Package body created.
    SQL>
    SQL>
    SQL> VARIABLE DTA REFCURSOR;
    SQL> EXEC ORAPDEV_PKG.DUAL_DATA(10,:DTA);
    PL/SQL procedure successfully completed.
    SQL> PRINT DTA
         EMPNO
          7782
          7839
          7934
    SQL>
    SQL>
    SQL>
    SQL> GRANT EXECUTE ON ORAPDEV_PKG TO PUBLIC;
    Grant succeeded.
    SQL> New Session of Another Database
    SQL> CONNECT XXX/XXX@CISDPD
    Connected.
    SQL> create public database link PNRAPD connect to xxx identified by xxx using 'pnrapd';
    Database link created.
    SQL> SELECT COUNT(*) FROM ALL_TABLES@PNRAPD
      2  /
      COUNT(*)
           722
    SQL>
    SQL> CREATE PUBLIC SYNONYM ORAPDEV_PKG FOR ORAPDEV_PKG@PNRAPD;
    Synonym created.
    SQL>
    SQL> VARIABLE DTA REFCURSOR;
    SQL> EXEC ORAPDEV_PKG.DUAL_DATA(10,:DTA);
    BEGIN ORAPDEV_PKG.DUAL_DATA(10,:DTA); END;
    ERROR at line 1:
    ORA-01001: invalid cursor
    ORA-02063: preceding line from PNRAPD
    SQL>
    SQL>
    SQL> SELECT * FROM GLOBAL_NAME;
    GLOBAL_NAME
    CISDPD
    SQL>
    SQL> EXEC ORAPDEV_PKG.DUAL_DATA@pnrapd(10,:DTA);
    BEGIN ORAPDEV_PKG.DUAL_DATA@pnrapd(10,:DTA); END;
    ERROR at line 1:
    ORA-01001: invalid cursor
    ORA-02063: preceding line from PNRAPD
    SQL> SELECT COUNT(*) FROM ALL_TABLES@PNRAPD
      2  /
      COUNT(*)
           722
    SQL>
    SQL> select * from v$version
      2  /
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    PL/SQL Release 9.2.0.7.0 - Production
    CORE    9.2.0.7.0       Production
    TNS for Linux: Version 9.2.0.7.0 - Production
    NLSRTL Version 9.2.0.7.0 - Production
    SQL> 

    again.....:(
    how can I resolve this issue ??
    PNRAPD DATABASE
    CREATE OR REPLACE PACKAGE orapdev_pkg IS
      TYPE rcursor IS REF CURSOR;
      PROCEDURE dual_data(p_deptno  IN NUMBER
                         ,resultset IN OUT rcursor);
    END orapdev_pkg;
    CREATE OR REPLACE PACKAGE BODY orapdev_pkg IS
      PROCEDURE dual_data(p_deptno  IN NUMBER
                         ,resultset IN OUT rcursor) IS
      BEGIN
        OPEN resultset FOR 'SELECT EMPNO FROM SCOTT.EMP WHERE DEPTNO = ' || p_deptno;
      END;
    END orapdev_pkg;
    CISDPD DATABASE
    SQL> var dta ORAPDEV_PKG.RCURSOR;
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
                        VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
                        NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
                        BINARY_FLOAT | BINARY_DOUBLE ] ]
    SQL>
    SQL>
    SQL>
    SQL> declare
      2  vempno   scott.emp.empno@pnrapd%type;
      3  DTA      ORAPDEV_PKG.RCURSOR;
      4  begin
      5  ORAPDEV_PKG.DUAL_DATA(10,DTA);
      6  LOOP
      7  FETCH DTA
      8  INTO  vempno;
      9  EXIT WHEN dta%NOTFOUND;
    10  DBMS_OUTPUT.PUT_LINE(vempno);
    11  END LOOP;
    12  CLOSE dta;
    13  end;
    14  /
    declare
    ERROR at line 1:
    ORA-01001: invalid cursor
    ORA-06512: at line 7Please help.

  • INVALID CURSOR - Anonymous Block calling Cursor in function

    I am getting an error when trying to call my cursor.
    CREATE OR REPLACE PACKAGE tax_update
    AS
    TYPE gencur IS ref cursor;
    FUNCTION tax_sf
       p_state IN bb_tax.state%type,
       p_thecursor IN OUT gencur
    RETURN NUMBER;
    END;
    CREATE OR REPLACE PACKAGE BODY tax_update
    AS
    FUNCTION tax_sf
       p_state IN bb_tax.state%type,
       p_thecursor IN OUT gencur
    RETURN NUMBER
      IS
      lv_taxrate NUMBER;
    BEGIN
      OPEN p_thecursor FOR
       SELECT taxrate
       FROM bb_tax
       WHERE state = p_state;
      RETURN lv_taxrate;
    END;
    END;
    DECLARE
      tax_cur tax_update.gencur;
      rec_tax bb_tax%rowtype;
    BEGIN
    LOOP
      FETCH tax_cur INTO rec_tax;
       EXIT WHEN tax_cur%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(rec_tax.taxrate);
    END LOOP;
    END;
    DECLARE
    ERROR at line 1:
    ORA-01001: invalid cursor
    ORA-06512: at line 6Assignment is to create a package that will hold tax rates by state in a packaged cursor. The package will contain a function that can receive a 2 character state abbr. as an argument and find a match in the cursor and return the tax rate for tha tstate. An anonymous block will test the function with state of NC.
    Can anyone assist?

    You would need to call the function to open the cursor before you try to fetch from the cursor
    DECLARE
      tax_cur tax_update.gencur;
      rec_tax bb_tax%rowtype;
      l_some_number number;
    BEGIN
      l_some_number :=  tax_update.tax_sf( <<some state parameter>>, tax_cur );
      LOOP
        FETCH tax_cur INTO rec_tax;
        EXIT WHEN tax_cur%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(rec_tax.taxrate);
      END LOOP;
    END;A couple of points, though.
    1) Your function returns a NUMBER but that NUMBER will always be NULL. It seems rather unlikely that this is really what you want. It would seem to make more sense for the function to return the cursor rather than returning a superfluous number.
    2) Your function requires a `bb_tax.state%type` parameter. But your anonymous block doesn't seem to have any concept of a state so I'm not sure what you want to pass in there.
    3) Looking at the code, it seems a bit odd that your cursor returns a single column of data. If a state can have multiple rates, wouldn't you need to select some additional criteria in order to figure out which sort of tax each row represents or to otherwise differentiate different rows? If a state can only have a single tax rate, it makes no sense to open a cursor that is only going to ever return a single row.
    4) There is no need to declare your own weak ref cursor type (tax_update.gencur). You can just use the Oracle built-in type SYS_REFCURSOR.
    Justin

  • Invalid Cursor, Please HEPL ME!!!!!!!

    I see the following error:
    ERROR at line 1:ORA-01001: invalid cursor
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 824ORA-06512: at "SYS.DBMS_SQL", line 32
    ORA-06512: at "IWF_ADMIN.SP_ESTADISTICAS", line 38ORA-06512: at line 2
    with the following code:
    create or replace procedure SP_ESTADISTICASisc_idsite number;c_hora number;
    c_dia number;c_fail number:=0;c_incomple number:=0;c_comple number:=0;
    c_qnc number:=0;c_wap number:=0;c_fax number:=0;sumbusy number:=0;
    c_busy number:=0;sumtime number:=0;sumin number:=0;sumout number:=0;
    fechai date;Temp varchar2(20);fechac varchar2(20);--fechac date;
    fechaf date;--cursor cursor_est return (idsite tablecall.idsite%typefecha
    tablecall.fecha%type, bytein tablecall.bytein%type, typecall
    tablecall.typecall%type, num_busych tablecall.num_busych%type, tiempoconec
    tablecall.tiempoconec%type);cursor_est tablecall2%ROWTYPE;fdbk INTEGER;
    cur INTEGER := DBMS_SQL.OPEN_CURSOR;v_select varchar2(200);begin
    select concat(to_char(min(fecha),'dd/mm/yyyy'),' ') into Temp from tablecall2;
    for cur_idsite in (select distinct(idsite) as idsite from tablecall2) loop
    for c_dia in 0..31 loop fechai:=to_date(Temp,'dd/mm/yyyy');
    fechai:=fechai + c_dia; for c_hora in 0..23 loop
    -- fechac:=to_date(Temp&#0124; &#0124;to_char(c_hora,'fm09')&#0124; &#0124;':00:00');
    fechac:=Temp&#0124; &#0124;to_char(c_hora,'fm09');
    -- fechaf:=to_date(Temp&#0124; &#0124;to_char(c_hora,'fm09')&#0124; &#0124;':59:59');
    v_select:='select idsite,fecha,bytein,typecall,num_busych,tiempoconec
    from tablecall2 where idsite ='&#0124; &#0124;to_char(cur_idsite.idsite,'fm0999')&#0124; &#0124;' and
    to_char(fecha,'&#0124; &#0124;chr(39)&#0124; &#0124;'dd/mm/yyyy hh24:mi:ss'&#0124; &#0124;chr(39)&#0124; &#0124;') like
    '&#0124; &#0124;chr(39)&#0124; &#0124;fechac&#0124; &#0124;'%'&#0124; &#0124;chr(39);
    DBMS_SQL.PARSE(cur,v_select,DBMS_SQL.NATIVE);
    DBMS_SQL.DEFINE_COLUMN(cur, 1, 1);
    DBMS_SQL.DEFINE_COLUMN(cur, 2, sysdate);
    DBMS_SQL.DEFINE_COLUMN(cur, 3, 1); DBMS_SQL.DEFINE_COLUMN(cur, 4, 1);
    DBMS_SQL.DEFINE_COLUMN(cur, 5, 1); DBMS_SQL.DEFINE_COLUMN(cur, 6, 1);
    fdbk := DBMS_SQL.EXECUTE(cur); LOOP
    EXIT WHEN DBMS_SQL.FETCH_ROWS(cur) = 0;
    DBMS_SQL.COLUMN_VALUE(cur,1,cursor_est.idsite);
    DBMS_SQL.COLUMN_VALUE(cur,2,cursor_est.fecha);
    DBMS_SQL.COLUMN_VALUE(cur,3,cursor_est.bytein);
    DBMS_SQL.COLUMN_VALUE(cur,4,cursor_est.typecall);
    DBMS_SQL.COLUMN_VALUE(cur,5,cursor_est.num_busych);
    DBMS_SQL.COLUMN_VALUE(cur,6,cursor_est.tiempoconec);
    if cursor_est.bytein=0 then c_fail:=c_fail+1; end if;
    if cursor_est.bytein<125 then c_incomple:=c_incomple+1; end if;
    if cursor_est.bytein>125 then c_comple:=c_comple+1; end if;
    if cursor_est.typecall=2 then c_fax:=c_fax+1; end if;
    if cursor_est.typecall=1 then c_qnc:=c_qnc+1; end if;
    if cursor_est.typecall=0 then c_wap:=c_wap+1; end if; c_busy:=c_busy+1;
    sumbusy:=cursor_est.num_busych + sumbusy;
    sumtime:=cursor_est.tiempoconec + sumtime; sumin:=cursor_est.bytein + sumin;
    sumout:=cursor_est.byteout + sumout; END LOOP; if c_busy<>0 then
    sumbusy:=sumbusy/c_busy; else sumbusy:=0; end if;
    execute immediate 'insert into tableest
    values('&#0124; &#0124;to_char(cur_idsite.idsite,'fm0999')&#0124; &#0124;',
    to_date(concat('&#0124; &#0124;chr(39)&#0124; &#0124;fechac&#0124; &#0124;chr(39)&#0124; &#0124;','&#0124; &#0124;chr(39)&#0124; &#0124;':00:00'&#0124; &#0124;chr(39)&#0124; &#0124;'),'&#0124; &#0124;chr(39)&#0124; &#0124;'dd/mm/yyyy
    HH24:mi:ss'&#0124; &#0124;chr(39)&#0124; &#0124;'),'&#0124; &#0124;to_char(c_fail,'fm0999999999')&#0124; &#0124;','&#0124; &#0124;to_char(c_incomple,'fm0999999999')&#0124; &#0124;','&#0124; &#0124;to_char(c_comple,'fm0999999999')&#0124; &#0124;','&#0124; &#0124;to_char(c_wap,'fm0999999999')&#0124; &#0124;','| |to_char(c_qnc,'fm0999999999')&#0124; &#0124;','&#0124; &#0124;to_char(c_fax,'fm0999999999')&#0124; &#0124;','&#0124; &#0124;to_char(sumbusy,'fm0999999999')&#0124; &#0124;','&#0124; &#0124;to_char(sumtime,'fm0999999999')&#0124; &#0124;','&#0124; &#0124;to_char(su min,'fm0999999999')&#0124; &#0124; ','&#0124; &#0124;to_char(sumout,'fm0999999999')&#0124; &#0124;')';
    commit; execute immediate 'delete from tablecall2 where
    idsite='&#0124; &#0124;to_char(cur_idsite.idsite,'fm0999')&#0124; &#0124;' and
    to_char(fecha,'&#0124; &#0124;chr(39)&#0124; &#0124;'dd/mm/yyyy HH24:mi:ss'&#0124; &#0124;chr(39)&#0124; &#0124;') like
    '&#0124; &#0124;chr(39)&#0124; &#0124;fechac&#0124; &#0124;'%'&#0124; &#0124;chr(39);-- commit;
    DBMS_SQL.CLOSE_CURSOR (cur); end loop; end loop;end loop;
    end;
    what is happening it?, how can to resolve it?
    Thank by any idea.
    null

    It is very difficult to read. However, the previous reply is correct you have closed the cursor inside the loop.
    Also, hoping you will take this as a suggestion, I have modified the proc to utilize 8i features and get rid of the DBMS_SQL utility (to much coding) and the CHR(39)
    I would have written this in spanish but my ability to write in spanish is shamefull, but
    BUENA SUERTE CON TU PROJECTO.
    create or replace procedure SP_ESTADISTIC AS
    c_dia number;
    c_fail number:=0;
    c_incomple number:=0;
    c_comple number:=0;
    c_qnc number:=0;
    c_wap number:=0;
    c_fax number:=0;
    c_busy number:=0;
    sumbusy number:=0;
    sumtime number:=0;
    sumin number:=0;
    sumout number:=0;
    fechai date;
    Temp varchar2(20);
    fechac varchar2(20);
    TYPE REF_CUR IS REF CURSOR ;
    CV REF_CUR ;
    v_sql_stmt varchar2(2000);
    TYPE CUR_REC IS RECORD
    (idsite tablecall.idsite%type,
    fecha tablecall.fecha%type,
    bytein tablecall.bytein%type,
    typecall tablecall.typecall%type,
    num_busych tablecall.num_busych%type,
    tiempoconec tablecall.tiempoconec%type);
    CUR_DATA CUR_REC ;
    BEGIN
    select concat(to_char(min(fecha),'dd/mm/yyyy'),' ') into Temp from tablecall2;
    for cur_idsite in (select distinct(idsite) as idsite from tablecall2) loop
    for c_dia in 0..31 loop
    fechai:=to_date(Temp,'dd/mm/yyyy');
    fechai:=fechai + c_dia;
    for c_hora in 0..23 loop
    fechac := Temp&#0124; &#0124;to_char(c_hora,'fm09');
    V_SQL_STMT :='select idsite, fecha, bytein, typecall, num_busych, tiempoconec '&#0124; &#0124;
    ' from tablecall2 where idsite = '&#0124; &#0124;
    to_char(cur_idsite.idsite, 'fm0999') &#0124; &#0124;
    ' and to_char(fecha, ''dd/mm/yyyy hh24:mi:ss'' ) '&#0124; &#0124;
    ' like '''&#0124; &#0124; fechac &#0124; &#0124; '%'' ';
    OPEN CV FOR v_sql_stmt ;
    LOOP
    FETCH CV INTO CUR_DATA ;
    EXIT WHEN CV%NOTFOUND;
    if CUR_DATA.bytein=0 then c_fail:=c_fail+1; end if;
    if CUR_DATA.bytein<125 then c_incomple:=c_incomple+1; end if;
    if CUR_DATA.bytein>125 then c_comple:=c_comple+1; end if;
    if CUR_DATA.typecall=2 then c_fax:=c_fax+1; end if;
    if CUR_DATA.typecall=1 then c_qnc:=c_qnc+1; end if;
    if CUR_DATA.typecall=0 then c_wap:=c_wap+1; end if;
    c_busy:=c_busy+1;
    sumbusy := CUR_DATA.num_busych + sumbusy;
    sumtime := CUR_DATA.tiempoconec + sumtime;
    sumin := CUR_DATA.bytein + sumin;
    -- sumout:=CUR_DATA.byteout + sumout;
    END LOOP;
    if c_busy<>0 then
    sumbusy:=sumbusy/c_busy;
    else
    sumbusy:=0;
    end if;
    v_sql_stmt := 'insert into tableest '&#0124; &#0124;
    ' values(:1, :2, :3, :4, :5, :6, '&#0124; &#0124;
    ':7, :8, :9, :10, :11, :12 ) ' ;
    execute immediate v_sql_stmt using
    to_char(CUR_DATA.idsite,'fm0999'),
    to_date(fechac&#0124; &#0124;':00:00', 'dd/mm/yyyyHH24:mi:ss'),
    to_char(c_fail, 'fm0999999999'),
    to_char(c_incomple,'fm0999999999'),
    to_char(c_comple, 'fm0999999999'),
    to_char(c_wap, 'fm0999999999'),
    to_char(c_qnc, 'fm0999999999'),
    to_char(c_fax, 'fm0999999999'),
    to_char(sumbusy, 'fm0999999999'),
    to_char(sumtime, 'fm0999999999'),
    to_char(sumin, 'fm0999999999') ,
    to_char(sumout, 'fm0999999999') ;
    execute immediate
    'delete from tablecall2 where idsite='
    &#0124; &#0124;to_char(cur_idsite.idsite,'fm0999')
    &#0124; &#0124;' and to_char(fecha,''dd/mm/yyyy HH24:mi:ss'' ) '
    &#0124; &#0124;' like '''&#0124; &#0124; fechac &#0124; &#0124; '%'' ';
    commit;
    end loop;
    close CV;
    end loop;
    end loop;
    end;

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

  • ORA-01001 error while TSPITR

    I keep on getting ORA-01001 : invalid cursor error while trying to transport a tablespace as a part of TSPITR.
    Here is how it looks:
    ===================================================
    C:\>exp parfile=c:\exp_transport.par
    Export: Release 9.2.0.1.0 - Production on Tue Apr 27 14:47:19 2004
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    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 819
    ORA-06512: at "SYS.DBMS_SQL", line 19
    ORA-06512: at "SYS.DBMS_TTS", line 774
    ORA-25153: Temporary Tablespace is Empty
    ORA-06512: at "SYS.DBMS_PLUGTS", line 1093
    ORA-06512: at line 1
    EXP-00000: Export terminated unsuccessfully
    ===================================================
    Any suggestion ?

    Guys,
    Come on Give me a Solution.
    Badly Needed....

Maybe you are looking for

  • When trying to sync with itunes error message reads Apple mobile device not started.  I pod turns on but does not connect to itunes

    When I try to sync my ipod with itunes I get an error message which tells me Apple mobile device is not started.

  • While Accessing UWL iviews - Issues with PCD Paths.

    Hello All, We Are using EP 7.0 SP 18. I am trying to access the UWL  iview with two different paths. Path1 :--> http://xxxx:50xxx/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fevery_user!2fgeneral!2feu_core_role!2fcom.sap.uwl.home_core_ws!2fc

  • Select Last 7 days

    How can I select last 7 days from my table, I use query but it is calculating according to sysdate It is the data of my talble DP_DATE 03-APR-10 21-APR-10 22-APR-10 23-APR-10 26-APR-10 27-APR-10 28-APR-10 29-APR-10 30-APR-10 03-MAY-10 04-MAY-10 11 ro

  • Copying X series BIOS settings to many, many machines

    Looking for assistance and ideas for copying desired BIOS settings to many, many machines; both X61 and X200's. NOTE: without using the new SRCMOS tool that is too expensive. Looks like we will be going to Altiris soon; if that helps. I'm not a netwo

  • Role grouping

    Hi Xperts Role group has been created and couple of roles assigned to it.But when creating Org and Group, my role grouping is not displayed in the drop down list.At the same time it is available in the list if trying to create Person. Can somebody th