Invalid cursor in Oracle 9i (but works on 11g)

Hi,
I have the function:
function get_capat_transa(p1 sys_refcursor, p2 number) return varchar2 is
  cod varchar2(40);
begin
  for i in 1..p2 loop
    fetch p1 into cod;
  end loop;
  return cod;
end;Ok, when i call this function in 11g like:
select get_capat_transa( osapi_ni.getCapatTransa('0373',100, 23453425), 1 ) cod
from dual
The first parameter supplied is osapi_ni.getCapatTransa('0373',100, 23453425), another function within a package, which returns a ref_cursor.
This works with no errors in Oracle 11g.
The same select written in Oracle 9i generates the error:
ORA-01001: invalid cursor
I pressed Yes to view the stack error and i got that the error raises from the line 'fetch p1 into cod'.
Any workaround for this, to work in 9i also?
Thanks!
Edited by: Roger22 on 18.08.2011 09:02
Edited by: Roger22 on 18.08.2011 09:03

Hi, It did not helped me..
More simply (so a simplest example) - you can try in 9i:
create or replace function getCapatTransa2 return sys_Refcursor is
   tmp sys_Refcursor;
   error varchar2(1500);
begin
    open tmp for select 'x' from dual;
    return tmp;
end getCapatTransa2;then
create or replace function get_capat_transa(p1 sys_refcursor, p2 number) return varchar2 is
  cod varchar2(40);
begin
  for i in 1..p2 loop
--    if p1%isopen then
      --raise_application_error (-20667, cod);
      fetch p1 into cod;
  end loop;
  return cod;
end;and finally:
select get_capat_transa(getCapatTransa2, 1 ) cod
  from dualWhy in 9i returns invalid cursor and in 11 returns 'x' ? Seems like in 9i the cursor p1 is not open, but why? i can't explain..
Edited by: Roger22 on 18.08.2011 10:43

Similar Messages

  • Unable to create MV in Oracle 9i, but works in 10g

    For what ever reason, we are developing in Oracle 10g, but production implementation will be in Oracle 9i. I was able to successfully create this MV using the FAST REFRESH ON COMMIT option in 10g, but received a ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view, when attempting to create it in 9i. I've followed Oracle's documentation on the restrictions for creating Fast Refresh MV's in 9i, and it appears all conditions have been met. The DBA has yet to grant me execute on the DBMS_MVIEW.EXPLAIN_MVIEW package and SELECT privilege on MV_CAPABILITIES_TABLE, so I don't know what could be wrong. Any ideas?
    create materialized view log on tb_slea_eligible_emp
    with sequence, rowid INCLUDING new values;
    create materialized view log on tb_slea_election
    with sequence, rowid INCLUDING new values;
    create materialized view log on tb_slea_recclub_award
    with sequence, rowid INCLUDING new values;
    create materialized view log on tb_slea_initiation
    with sequence, rowid INCLUDING new values;
    DROP MATERIALIZED VIEW MV_SLEA_CONTRIBUTION;
    CREATE MATERIALIZED VIEW MV_SLEA_CONTRIBUTION
    BUILD IMMEDIATE
    REFRESH FAST ON COMMIT
    WITH PRIMARY KEY
    AS
    SELECT emp.slea_year,
           emp.empid,
           NVL (t1.original_bal, 0) recclub_amt,
           NVL (t2.initiation_amt, 0) initiation_amt,
           (NVL (t1.original_bal, 0) + NVL (t2.initiation_amt, 0)) firm_funded_amt,
           NVL (elect.slea_min_amt, 0) slea_min_amt,
           elect.slea_add_amt,
           NVL (elect.slea_fullyr_amt, 0) slea_fullyr_amt,
           (NVL (t1.original_bal, 0) + NVL (t2.initiation_amt, 0) + NVL (elect.slea_fullyr_amt, 0)) total_acct,
           emp.ROWID elig_emp_rowid,
           elect.ROWID election_rowid,
           t1.ROWID recclub_rowid,
           t2.ROWID initiation_rowid
      FROM tb_slea_eligible_emp emp,
           tb_slea_election elect,
           (SELECT ROWID, empid, original_bal
              FROM tb_slea_recclub_award
             WHERE slea_year = 2007 
               AND record_type = 'C') t1,
            (SELECT ROWID, empid, initiation_amt
              FROM tb_slea_initiation
             WHERE slea_year = 2007 ) t2
    WHERE emp.empid = elect.empid
       AND emp.slea_year = 2007
       AND emp.empid = t1.empid(+)
       AND emp.empid = t2.empid(+)
       AND emp.slea_year = elect.slea_year
       AND emp.eligible_ind = 'Y'
       AND elect.record_type = 'C';
    CREATE INDEX MV_SLEA_CONTRIB_IDX1 ON MV_SLEA_CONTRIBUTION
    (elig_emp_rowid);
    CREATE INDEX MV_SLEA_CONTRIB_IDX2 ON MV_SLEA_CONTRIBUTION
    (election_rowid);
    CREATE INDEX MV_SLEA_CONTRIB_IDX3 ON MV_SLEA_CONTRIBUTION
    (recclub_rowid);
    CREATE INDEX MV_SLEA_CONTRIB_IDX4 ON MV_SLEA_CONTRIBUTION
    (initiation_rowid);

    Yes, it boggles me as to why production is a STEP DOWN from development environment. Probably because there are like 20 other applications still on the production database that are not ready to upgrade to 10g...nevermind being ready for 11g!
    I went through the compatibility checklist, but I still don't understand what can be wrong. I was hoping that maybe someone else has gone through MV incompatibility between 10g and 9i that could share their experience.

  • IPlanet J2EE application not working with oracle 9i but working with 7.3

    We are in a process of upgrading database from oracle 7.3 to 9i.
    We have a working application running on iPlanet Application Server with oracle 7.3 as database. We are using iPlanet Application Server's connection pooling. Our JDBC driver is classes111.zip.
    After upgrading to 9i, our application doesnt work. When I try to run a test application that uses single select statement, this the error I get: java.sql.SQLException: Invalid URL: Driver type not specified
    SQL*PLUS works fine. I havent upgraded oracle client. Do I need to upgrade the JDBC driver or oracle client?
    Any suggestions? iAS version is 6.5.

    If you are new to JSF, then I'd try and simplify the environment in which you are working as the first step to achieving a successful outcome.
    JSF 1.2 is a certified and well tested component of WLS, so we know it works. I'm not sure of the effect of all those additional modules you are adding in there -- it appears as if you have gotten a Faces implementation instantiated, but there could be some form of version difference/conflict since it can't find a method its looking for.
    Using Oracle Enterprise Pack for Eclipse (http://www.oracle.com/technology/software/products/oepe/oepe_11115.html) you can build yourself out a pretty simple JSF application to get started from and deploy it to a WLS server. This would remove all the additional libraries you currently have, provide you with a bundled applicaton to deploy and give you a pretty good environment from which you can learn and experiment with JSF.
    -steve-

  • Select query hangs on Oracle 9i but works fine in Oracle 8i

    Hi Guys,
    For a recap of what happened:
    Migrated from Oracle 8i to 9i for a customer, all queries and statements are working fine, except for this particular query. If i run the same query on 8i it works like a charm.
    In 9i, if i remove even one field from the query, it works else it just hangs.
    Any idea, any one???
    **Added 2:09PM: When i removed some ltrim and rtrim that i believe not necessary, the query works fine, is there any field length limitation in Oracle 9i???
    Below is the query:
    set pagesize 100;
    set linesize 1024;
    set heading off;
    set echo off;
    spool scb_xfer_hdr_npsx;
    select ltrim(rtrim(to_char(hdr_srl_no,'99'))) || ';' ||
    'P' || ';' || rtrim(ltrim(payment_type))|| ';'|| ';' ||
    ltrim(rtrim(our_ref_no))|| ';'|| 'MY;KUL;' ||
         rtrim(ltrim(debit_account_no))||';'||
    rtrim(ltrim(to_char(scb_batch_date,'YYYY/MM/DD'))) || ';'|| ';' ||
    rtrim(ltrim(payee_name_1))|| ';'|| ';' ||
    rtrim(ltrim(address_1))|| ';'||
    rtrim(ltrim(address_2))|| ';'||
    rtrim(ltrim(address_3))|| ';'|| ';' ||
    rtrim(ltrim(payee_name_11))|| ';' ||
    rtrim(ltrim(address_11))|| ';'||
    rtrim(ltrim(address_21))|| ';'||
    rtrim(ltrim(address_31))|| ';'|| ';' ||
         rtrim(ltrim(payee_bank_code)) || ';' || ';' ||
         rtrim(ltrim(payee_account_no)) || ';' ||
         rtrim(ltrim(our_ref_no2)) || ';' || ';' ||
         rtrim(ltrim(our_ref_no2)) || ';' || ';' || ';' || ';' ||
    rtrim(ltrim(payment_currency))|| ';'||
    rtrim(ltrim(to_char(payment_amount,'9999999999.99')))|| ';'||
         'C;P;;' || rtrim(ltrim(payee_bank_name))|| ';' ||
         'KL;;' ||
         rtrim(ltrim(delivery_method)) || ';' ||
         rtrim(ltrim(delivery_by)) || ';' ||
         rtrim(ltrim(counter_pickup_location))
    from scb_xfer_hdr_npsx
    order by hdr_srl_no;
    select distinct 'T;' || ltrim(rtrim(to_char(total_payments))) || ';' ||
         ltrim(rtrim(to_char(total_pay_amount,'9999999999.99')))
    from scb_xfer_hdr_npsx;
    spool off;
    spool scb_xfer_dtl_npsx;
    select ltrim(rtrim(to_char(srl_no,'99'))) || ';' || 'I' || ';' ||
         ltrim(rtrim(doc_no)) || ';' || ltrim(rtrim(to_char(doc_date,'yyyy/mm/dd'))) || ';' ||
         ltrim(rtrim(doc_description)) || ';' ||
         ltrim(rtrim(to_char(doc_amount,'9999999999.99')))
    from scb_xfer_dtl_npsx
    order by srl_no;
    spool off;
    set echo on;
    exit;
    Message was edited by:
    Logesh

    Hi,
    are you still on a 32bit kernel on AIX?
    How are the Form4.5 connected, are they on the same box, or are they using the forms GUI?
    What about the statistics, how do you collect them? Is the database set to the COST based optimizer?
    Do you use dbms_utility.analyze_schema, or this:
    exec dbms_stats.gather_schema_stats( -
    ownname => '$OWNER', -
    estimate_percent => 10, -
    granularity => 'ALL', -
    method_opt => 'FOR ALL COLUMNS SIZE 75', -
    degree => NULL , -
    options => 'GATHER $GATH', -
    cascade => TRUE -
    What does it mean the SQL hangs? Can you cancel the query? Do you have to kill the session? Do you use any diagnostic tools like TOAD to trace the session, see what it is doing? Usually if this is a performance/tuning issue, you will see the session is not dead, but you will see advancing reads.
    Regards,
    Richard.

  • 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

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

  • Why our online software on java/oracle crashes on latest firefox 3.6.12 but worked on 3.0.9

    our online software on java crashes on latest firefox 3.6.12 but worked on 3.0.9

    Your above posted system details show outdated plugin(s) with known security and stability risks.
    *Shockwave Flash 9.0 r999
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    In Firefox 3.6 and later versions you need the Next-Generation Java™ Plug-In present in Java 6 U10 and later (Linux: libnpjp2.so; Windows: npjp2.dll).
    http://java.com/en/download/faq/firefox_newplugin.xml
    See also http://java.sun.com/javase/6/webnotes/install/jre/manual-plugin-install-linux.html

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

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

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

  • Setting array size, effect on memory

    Does setiing the array size to a huge no has any affect on the memory, performance and is it considered good programming. If not what are the other options? String [] arrayString = new String [2354];

  • Most efficient way to constantly read, queue and parse multi-size​d RS232 data (multi-thr​eaded)

    I've tried tackling this problem a few different ways, and figured it was time to get some others' advice.  My system essentially works, although it looks like a hackjob and not entirely confident. My RS-232 connection has the following properties/co

  • Acrobat pro x korean version download link?

    I bought CS6 design standard 2 years ago it comes with Photoshop, Illustrator, Indesign, and Acrobat X Pro. I was able to download all three program one by one in Korean version, but not Acrobat X Pro. So I downloaded English version but my serial is

  • DbKona and large resultsets

    Hi, I'm working on a application that will allow a user to run ad-hoc queries against a database. These queries can return huge resultsets (between 50,000 & 450,000 rows). Per our requirements, we can't limit (through the database anyway) the number

  • Lost hard drive space

    Hi, I just bought mac mini which is working great but I have lost a lot of hard drive space. My mini says it has 74.5 GB hard drive according to the system profiler, but after doing the transferring of information as per the Mac mini user guide using