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.

Similar Messages

  • 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 when I want to modify itab with READ TABLE ?

    Following code causes a core dump and says invalid cursor.
    What should I do if I want to change gt_itab .?
    REPORT  ZEV_READ_TABLE.
    data: begin of gt_itab occurs 0,
           key like vbrk-vbeln,
           name(10) type C,
           amount type i,
          end of gt_itab .
    start-of-SELECTION.
          gt_itab-key = 1.
          gt_itab-name = 'erkan'.
          gt_itab-amount = 10.
          append gt_itab.
          gt_itab-key = 2.
          gt_itab-name = 'dilem'.
          gt_itab-amount = 20.
          append gt_itab.
          LOOP AT gt_itab.
            write:/ gt_itab-key,
                    gt_itab-name,
                    gt_itab-amount.
          ENDLOOP.
          Read table gt_itab with key Key = 1.
           if sy-subrc = 0.
              gt_itab-amount = 100.
              modify gt_itab.
           endif.
    Kind Regards.
    Erkan VAROL

    Change the code this way & try
    modify gt_itab index sy-tabix.

  • Invalid Cursor state Exception  -  Help required

    Hi,
    I'm having a web page(JSP), which is making use of 3 ResultSet objects. Using the first two, i'll populate two different Drop down list, with values from database(Access) while loading the page for first time.
    Now if the user select any value from any (or both) of drop down list and clicks submit, i need to display all values in database, meeting the criteria from first & second drop down list. For this selection, i'm using the third ResultSet variable. While executing the query, i'm sure that 3rd ResultSet is returning some value. But when i try to retrieve the value to a string variable, i'm getting the Invalid cursor state exception.
    Throughout the page, i haven't closed any of the ResultSet. When i closed the first and second ResultSets in the third function(where 3rd ResultSet is used), i'm not getting any value. Its returning like ResultSet closed.
    Please help me to get this solved. It's very urgent because without this, i cannot proceed further. Please share your ideas.
    Thanks in advace for your valuable help

    If you open a new resultset within the same statement, all previously opened will be closed.
    Read the API docs, luke.

  • 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

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

  • 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 state when trying to insert record

    Hi everyone!
    I'm using JDBC-ODBC bridge to connect to a mySql database, which works fine. Then I try to insert new records, but this only works for the first record in the table.
    When there is already a record in the table, I always get "[Microsoft][ODBC Driver Manager] Invalid cursor state" when calling the updateRow()-method of the result set.
    Here is my code:            // open db connection
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection conn = DriverManager.getConnection("jdbc:odbc:TTManager", "xxxx", "xxxx");
                // Prepare SQL statement
                java.sql.Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                ResultSet result = stmt.executeQuery("SELECT * FROM Player");
                result.moveToInsertRow();Then all fields are filled in this manner:            result.updateString("Name", name);And finally the insertRow should be written to the db:            result.insertRow();But at this point it gives the mentioned error, including these messages:         at sun.jdbc.odbc.JdbcOdbcResultSet.setPos(JdbcOdbcResultSet.java:5272)
            at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow(JdbcOdbcResultSet.java:4132)Since I'm very unexperienced with Java, I guess (or hope^^) it's just some stupid beginner's mistake.
    Oh, almost forgot to mention: The new record's data doesn't violate any unique-constraints on the table, all fields are explicitely filled and all variable's data types are matching their according field types!
    Any help would be appreciated!
    reinski

    Ok, I needed to help myself and this is what I found out:
    If the table already contains records, it is not enough to doresult.moveToInsertRow();but I must beresult.last();
    result.moveToInsertRow();I didn't find any explanation and even the code examples from the Sun tutorial don't mention this, so I guess it's a bug occurring in my poor IT environment: DB server running mySQL 5.0.0-alpha on a P1-233-MMX w/ 64MB under WinNT4 (hey don't laugh!!^^).
    Maybe this information is of use to someone having similar problems...
    Greetings!
    reinski

  • 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. dont understand why

    i keep getting invalid cursor near the fetch. i dont understand why. appreicate any help.
    declare
      -- Local variables here
      o_errorcode NUMBER;
      o_errortext VARCHAR2(1000);
      i_CustomerLoop NBK.Pkgcommon.T_CUSTOMERLOOPTYPE;
      o_loopid number;
      FUNCTION createCustomerLoopObj(in_Loopid  IN NUMBER,
                                     inTestCAse IN VARCHAR2)
        RETURN NBK.Pkgcommon.T_CUSTOMERLOOPTYPE IS
        J_CustomerLoop NBK.Pkgcommon.T_CUSTOMERLOOPTYPE;
        co_clli        open_interface.WDN_segment.co_clli%type;
        termsysid      open_interface.WDN_segment.termsysid%type;
        cable          open_interface.WDN_segment.cable%type;
        pair           open_interface.WDN_segment.low_pair%type;
        v_cntLoops     number := 0;
        CURSOR v_CustomerLoops IS
          select seg_f1.termsysid,
                 seg_f1.cable,
                 round((seg_f1.low_pair + seg_f1.high_pair) / 2),
                 seg_f1.co_clli
            FROM open_interface.WDN_segment                  seg_f1,
                 open_interface.WDN_loop_segment_association assoc_f1,
                 open_interface.WDN_potential_loop_makeup    loop_f1
           where seg_f1.segment_id = assoc_f1.segment_id
             and assoc_f1.loopid = loop_f1.loopid
             and loop_f1.loopid = in_Loopid -- 44441549
           order by assoc_f1.segment_number asc;
      BEGIN
        loop
          fetch v_CustomerLoops
            into termsysid, cable, pair, co_clli;
          exit when v_CustomerLoops%notfound;
          begin
            v_cntLoops := v_cntLoops + 1;
            J_CustomerLoop(v_cntLoops).Cable := cable;
            J_CustomerLoop(v_cntLoops).Pair := pair;     
            J_CustomerLoop(v_cntLoops).CentralOfficeName := co_clli;
            J_CustomerLoop(v_cntLoops).TerminalDeviceID := termsysid;
          exception
            WHEN no_data_found THEN
              dbms_output.put_line('no data found loopid ' || in_Loopid ||
                                   ' TestCASE' || inTestCAse);
            WHEN OTHERS THEN
              dbms_output.put_line('OTHER ERROR  loopid ' || in_Loopid || ' ' ||
                                   SQLERRM || SQLCODE || 'TestCASE' ||
                                   inTestCAse);
          end;
        end loop;
        close v_CustomerLoops;
        RETURN J_CustomerLoop;
      end createCustomerLoopObj;
    begin
      i_CustomerLoop := createCustomerLoopObj(44441549, 'tc');
    end;

    10 Points to you. ;)
    Regards.
    Satyaki De.

  • Invalid Cursor Position Error

    Help!
    I am using JRun3.1 and developing a web interface to a database. In this particular screen, I am using CachedRowSet (I downloaded this and added it to jrun classpath). I am getting "Invalid cursor position" error.
    I feel there is a problem with the usebean tag.
    This is my code:
    what is wrong with this?
    <%@ page language = "java" import="java.sql.*, java.util.*, javax.sql.*, sun.jdbc.rowset.*" %>
    <%
    String indSub = request.getParameter("indSub");
    String areaname = request.getParameter("selarea");
    %>
    <jsp:useBean id="crs" class="CachedRowSet" scope="session" >
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    crs.setUrl("jdbc:odbc:asphData");
    crs.setCommand("SELECT siccode, sicdesc from siccode where sictitle = '" + indSub + "'");
    crs.execute();
    %>
    </jsp:useBean>
    <%@ include file="header2.htm" %>
    <link rel="stylesheet" href="http://localhost:8100/empData/almis.css" type="text/css">
    <br>
    <br>
    <table align="center">
    <tr><td class="moduleDesign" align="center">Employers Database</td></tr>
    </table>
    <br><br>
    <font size="+2" face="verdana sans-serif">
    <form action="employerDetail.jsp" method="post">
    <p><center><font color="Blue">Employers in the �<%= indSub %>� Industry
    <br>
    SIC Code:�<%= crs.getString("siccode") %>
    <br>State: Utah<br>
    Region: �<%=areaname %><br>
    </font></center></p>
    <p>
    <b>Description:</b>�<%= crs.getString("sicdesc") %>
    </p>
    </form>
    <jsp:include page="footer2.htm" />
    </body>
    </html>
    srajaman2

    Never mind!
    I have to issue a next() command to get to the first line of the resultset!
    srajaman2

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

Maybe you are looking for

  • Regarding sales order not created in xml file format

    Hi Friends,                    I have the xml file,I sort the xml file alphabetically on material master codes, WHen program try to create the sales order by using this xml file through call transaction method, the line item numbers does not matches

  • Photoshop Elements 8 Error Not Responding

    I am trying to get assistance in getting my photoshop back up and running.  I have called Adobe and there is no sympathy all they want is money to fix it.  They have sent me here to speak to an Adobe Tech.  I am finding that this is a very common iss

  • Can't print a word document after updating security

    I updated security software and now can't print any document that has been created by my word application

  • Mail not appearing on iphone

    Hi, I am using a single exchange 2003 server SP2 and the account I have set up on the iphone has verified but I am unable to see my mail in the Inbox. I have switched SSL off and this makes no difference. On my exchange 2007 server it works perfectly

  • Suspicious contact request

    I got a contact request from someone who claims to be a skype lottery agent named "skype.userlottery2012(JAMES HEROLD)" saying that I have emerged as one of your lucky winners for the year 2011 skype user's lottery. Is this a scam or do I need to add