ORA-24338: statement handle not executed

Hi,
My front end programming platform is .NET. Oracle DataBase is 10g.
I have written this package:
CREATE OR REPLACE package body USER_NAME.PACKAGE_TEST1 as
procedure getname(id1 number,tb_cursor out md_cursor)
as
begin
open tb_cursor for select name from testtable1 where id1=id;
close tb_cursor;
end getname;
end package_test1;In the front end i am using DataReader to fetch data.
But while Executing reader an error occurs that is "ORA-24338: statement handle not executed".
But when i remove "close tb_cursor" programm runs successfully.
What is the reason for that error ?

user12222356 wrote:
Tubby wrote:
A ref cursor is nothing more than a pointer to a statement (query).
So no, you do not want to make 1000 procedure calls. You want your ref cursor to be opened for a query that contains 1000 rows. The client calls your procedure ONE TIME and processes the entirety of the ref cursor (1000 rows), then closes the cursor that your procedure so graciously opened for them.But according to .NET(my front end platform) documentation DataReader fetches data from database row by row .each row at a time.That means when the procedure was first called REF CURSOR was opened and was open till all data are fetched.Means at the begining itself query was executed and all data was fetched and stored temporarily in the database, and then DataReader fetched those data row by row..i.e., after first call to procedure only fetching of data is done. NO opening,NO closing ,NO select query execution (that was referenced by REf CURSOR). And when all rows are fetched that open cursor is closed . Is my concept right here ?YOU opened the cursor (in your procedure).
The select query execution IS the ref cursor being processed by your DataReader.
The data is not temporarily stored in the database ... it persists there (unless someone deletes it) ... so that statement wasn't really correct. DataReader would just be reading the rows from the database (via the ref cursor)
I would assume DataReader will close the cursor for you, but i really don't know ... you'd have to ask a .not person about that.

Similar Messages

  • Err 62007: SQL Error: 99999 ORA-24338: Statement Handle not Executed

    Hi,
    I am facing a problem while adding a new parameter n my JSP Report JDBC query based on a ref-cursor from a stored procedure define in a package in database.
    No problem at database level, I have added the new parameter in package specification and Package body for that procedure and compile my package, it complies without any error and warning.
    but when I open the report and add parameter in the report JDBC query window, then it is generating a error message,
    "Err 62007: SQL Error: 99999 ORA-24338: Statement Handle not Executed "
    and I am unable to add the new parameter in report.
    e.g.
    Actual which was working is:
    My-package.My-procedure(:P1,:P2,:P3 ,:P4,:P5,:P6,:P7)
    I want to do this:
    My-package.My-procedure(:P1,:P2,:P3 ,:P4,:P5,:P6,:P7,:P8)
    but unable to do due to this error message:
    ("Err 62007: SQL Error: 99999 ORA-24338: Statement Handle not Executed ")
    Reports Builder 10g:
    Database 10g:
    Operating system windows XP:
    using JDBC Query base on ref-cursor coming from the stored procedure define in the Package.
    Regards,
    Khan

    and compile my package, it complies without any error and warning.That doesn't mean anything in this case. You are getting a runtime error, not a compilation error. The error is coming when you execute your procedure.
    Did you test your modified procedure in sqlplus or SQL Developer?

  • ORA-24338: statement handle not executed   -- error in returning refcursor

    My packaged procedure has Ref cursor as out variable.
    Calling the packaged procedure from Cognos 8. while trying to access the packaged procedure , getting the below error.
    ORA-24338: statement handle not executed
    Please provide a solution...

    Welcome to the forum!
    Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    Confirm that the procedure works properly when called from sql*plus.
    For example here is some code that tests a package procedure I have in the SCOTT schema
    SET SERVEROUTPUT ON SIZE 1000000
    DECLARE
      l_cursor  test_refcursor_pkg.my_ref_cursor;
      l_ename   emp.ename%TYPE;
      l_empno   emp.empno%TYPE;
    BEGIN
      test_refcursor_pkg.test_proc (l_cursor);
      LOOP
        FETCH l_cursor
        INTO  l_empno, l_ename;
        EXIT WHEN l_cursor%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE(l_ename || ' | ' || l_empno);
      END LOOP;
      CLOSE l_cursor;
    END;
    /

  • Urgent: ORA-24338: statement handle not executed

    Hello,
    /*===================================================*/
    PL/SQL code:
    SQL> create or replace package p3 is
    2 type t_c is ref cursor;
    3 procedure p(p_c out t_c);
    4 end p3;
    5 /
    Package created.
    SQL> show errors;
    No errors.
    SQL>
    SQL>
    SQL> create or replace package body p3 is
    2
    3 procedure p(p_c out t_c)
    4 is
    5 v_c t_c;
    6 begin
    7 open v_c for
    8 select job_number
    9 from rep_adhoc_invoices
    10 where rownum<5;
    11 end p;
    12 end p3;
    13 /
    Package body created.
    SQL> show errors;
    No errors.
    /*===================================================*/
    C# code:
    OracleConnection dbConnection = null; /* see finalize{} */
    OracleCommand dbCommand = null;
    OracleDataAdapter dbAdapter = null;
    try
         dbConnection = new OracleConnection(GetConnectionString());
         dbConnection.Open();
         dbCommand = new OracleCommand();
         dbCommand.Connection = dbConnection;
         dbCommand.CommandText = "p3.p";                    dbCommand.CommandType = CommandType.StoredProcedure;
         dbCommand.Parameters.Add("p_c", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output);
         dbAdapter = new OracleDataAdapter(dbCommand);
         System.Data.DataSet ds = new DataSet();
         dbAdapter.Fill(ds);
         return(ds);
    catch (Exception e)
         Console.WriteLine(e.Message);
    /*===================================================*/
    Problem:
    When code executes:
    dbAdapter.Fill(ds);
    I constantly get the ORA-24338.
    The same result if I try from console with "set autoprint on" (v_c is defined beforehand):
    SQL> execute p3.p(:v_c)
    PL/SQL procedure successfully completed.
    ERROR:
    ORA-24338: statement handle not executed
    It seems to me, that the problem is on the server.
    Does anyone know, WHAT is the problem?
    Thanks a lot beforehand!
    Edgar.

    In your procedure implementation (below), you forgot to assign the local variable v_c to the out parameter p_c before exiting the rountine. This means that the ref cursor parameter is never opened.
    The error you got occurs because when ODP.NET gets back the ref cursor it tries to fetch from it without checking whether it's open or not. If you look up the ORA-24338 error code in the documentation, it'll tell you as much. Typcially, when I get an error I don't understand, I head straight for the docs. They not only tell me what it means, but often suggest a solution.
    This behaviour of ODP must be for performance reasons, since doing the check everytime would be wasted most of the time. Still, it would have been nice if they'd emulated MSDAORA, which DOES check.
    3 procedure p(p_c out t_c)
    4 is
    5 v_c t_c;
    6 begin
    7 open v_c for
    8 select job_number
    9 from rep_adhoc_invoices
    10 where rownum<5;
    11 end p;
    12 end p3;
    13
    Frankly, I'm surprised you didn't get ORA-3113: end of communication channel. This is what happened to me when I exited a function without assigning the ref cursor. To solve it, I'd changed the declaration of the PL/SQL function and OracleCommand parameters to IN OUT instead of just OUT. THEN, I got ORA-24338. Anyway, watch out for these things as you progress.
    Happy coding.
    Clarence

  • Oracle Error - statement handle not executed state

    Hello,
    A BCA scheduled job has failed and returned with the following error. Does anyone have an idea to fix this error.
    Connection or SQL sentence error: (DA0005): [Exception: DBD, ORA-24338: statement handle not executed State: N/A] The following data providers have not been successfully refreshed
    Thanks
    -Gopi

    Please provide more information on what Crystal Reports or Business Objects product you are using. The more details you can provide, the quicker the resolution...
    Ludek

  • Statement handle not executed error

    Hi,
    I have a package which have a statement as follows.
    OPEN p_out_provider_w_POSAccess FOR
                   SELECT DISTINCT claim.cert_no, claim.rec_code,
                                   prov.ghi_prov_num, prov.irs_number tax_id,
                                   prov.full_name, prov.lastname, prov.firstname
                              FROM hmo.hmo_medical_claim claim,
                                   ipd2.i_provider prov,
                                   ipd2.i_provider_top pt,
                                   ops_arw.phr_top top,
                                   ops_arw.provider_pin pin
                             WHERE claim.cert_no =hmo_conv_num_to_letter (p_in_cert_no)
                               AND claim.rec_code = p_in_rec_code
                               AND claim.ghi_prov_num = prov.ghi_prov_num
                               AND claim.ghi_prov_num = pt.ghi_prov_num
                               AND claim.ghi_prov_num = pin.ghi_prov_num
                               AND pt.top_code = top.top_code
                          ORDER BY prov.lastname, prov.firstname;                                
                                    when I execute the package ,I get
    dweb1:ops_arw> PRINT p_out_provider_w_POSAccess
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "p_out_provider_w_POSAccess"Thanks

    user11253970 wrote:
    No I am not closing it.Just now I noticed that when I input values which are in Database it returns the result without any failure.But when I try to input values which are not in database ,Instead of returning zero rows it gives the error message.Then your SP logic branches in such way that values which are not in the database bypass open cursor statement:
    SQL> create or replace
      2    procedure p1(p_cur in out sys_refcursor,p_ind number)
      3    is
      4    begin
      5        if p_ind = 1
      6          then
      7            open p_cur for select ename from emp where deptno = 10;
      8        end if;
      9  end;
    10  /
    Procedure created.
    SQL> exec p1(:p_cur,1)
    PL/SQL procedure successfully completed.
    SQL> print p_cur
    ENAME
    CLARK
    KING
    MILLER
    SQL> exec p1(:p_cur,0)
    PL/SQL procedure successfully completed.
    SQL> print p_cur
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "p_cur"
    SQL> SY.

  • Java.sql.SQLException: statement handle not executed

    hello,
    i am calling a stored procedure and its returns a REF CURSOR and i am getting intermittent exceptions below,
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxxx_pkg(?,?)}]; SQL state [99999]; error code [17144]; statement handle not executed; nested exception is java.sql.SQLException: statement handle not executed
    and
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxxx_pkg(?,?,?)}]; SQL state [99999]; error code [17009]; Closed Statement; nested exception is java.sql.SQLException: Closed Statement
    any clue what could be the issue,
    Regards
    GG

    its pretty simple have a java class calling hibernateTemplate's findByNamedQueryAndNamedParam method by passing the procedure name and binding parameters/values, and here is the stack
    org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
    xxx_pkg(?,?)}]; SQL state [99999]; error code [17144]; statement handle not executed; nested exception is java.sql.SQLException: statement handle not executed
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
    at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
    at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
    at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1006)
    Caused by: java.sql.SQLException: statement handle not executed
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
    at oracle.jdbc.driver.T4CStatement.doDescribe(T4CStatement.java:701)
    at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3355)
    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:2009)
    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494)
    at org.hibernate.type.StringType.get(StringType.java:18)
    at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
    at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
    at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
    at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2091)
    at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
    at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
    at org.hibernate.loader.Loader.getRow(Loader.java:1206)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
    at org.hibernate.loader.Loader.doQuery(Loader.java:701)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
    at org.hibernate.loader.Loader.doList(Loader.java:2217)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2108)
    at org.hibernate.loader.Loader.list(Loader.java:2103)
    at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1696)
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
    at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1015)
    at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)

  • ORA-24338 Database connector error:  statement handle not executed

    I have written a procedure in PL/SQL Developer v 9.0.6.1665 that produces a ref cursor based on the criteria selected. It also produces a ref cursor if no data is selected.
    I can run this procedure in pl/sql with no errors. The problem comes when I'm trying to run the report in Crystal (Crystal 2008 v 12.4.0.966). When I verify the database in Crystal I receive this error.
    Is there a bug or something I'm overlooking? I've made sure the ref cursor for all outputs are exactly the same with the same name.

    Welcome to the forums.
    Crystal requires that all REF CURSORS be IN OUT parameters.
    Not posting code makes it very possible for people to help you beyond very generic advice such as I have provided.
    But Oracle 9.0.6? There is no value in working with something so old it belongs in a museum. Move your company into the current century.

  • ORA-24324: service handle not initialized

    I ran the catexp.sql and catalog.sql twice
    The first time on the user system in the sql
    and the second time on cmd i ran sqlplus /nolog
    connect system/xxx as sysdba.
    I use oracle on windows XP
    i have a problem with the export full like this
    . exporting object type definitions for user SYSTEM
    About to export SYSTEM's objects ...
    . exporting database links
    . exporting sequence numbers
    . exporting cluster definitions
    EXP-00056: ORACLE error 24324 encountered
    ORA-24324: service handle not initialized
    EXP-00056: ORACLE error 24324 encountered
    ORA-24324: service handle not initialized
    EXP-00000: Export terminated unsuccessfully
    Could you help me?

    the status listener.ora is started
    on the cmd
    set TERM=ansi
    set ORACLE_SID=banobras
    I tried do it by twice forms by line command and exp_car1.par
    where (exp_car1.par)
    userid=cartera/cartera
    file=exp_cartab_test.dmp
    log=log_cartab_test.log
    full=y
    C:\oracle\ora92>exp parfile=exp_car1.par
    Export: Release 9.2.0.1.0 - Production on MiÚ Dec 21 12:03:49 2005
    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
    server uses WE8ISO8859P15 character set (possible charset conversion)
    About to export the entire database ...
    . exporting tablespace definitions
    . exporting profiles
    . exporting user definitions
    . exporting roles
    . exporting resource costs
    . exporting rollback segment definitions
    . exporting database links
    . exporting sequence numbers
    . exporting directory aliases
    . exporting context namespaces
    . exporting foreign function library names
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions
    The process remains hung and does not advance, already it does not order mistakes
    Thanks in advance!

  • Insert statement is not executing.....

    From below procedure the insert statement is not executing....
    update statement is working perfectly but insert......
    create or replace PROCEDURE PAYMENT(AMT NUMBER,UID NUMBER) IS
    AMT1 NUMBER;
    AMT NUMBER;
    PD VARCHAR2(100);
    C1 NUMBER;
    PER NUMBER;
    ACC1 VARCHAR2(15);
    CF NUMBER;
    CRF NUMBER;
    ACC2 VARCHAR2(15);
    begin
    SELECT  PAY_DESC INTO PD FROM SUB.PAYMENT_TY WHERE ORD=0;
    SELECT NVL(AMOUNT,0) INTO C1 FROM FOOD.MEMBER WHERE LTRIM(RTRIM(UPPER(NAME))) LIKE
    LTRIM(RTRIM(UPPER(PD)))
    AND USER_ID=UID;
    IF NVL(C1,0)>AMT THEN /*CASH*/
    C1:=C1-AMT;
    SELECT ACCOUNT_CODE INTO ACC1 FROM SUB.MASTER WHERE PAY_CODE=2;
    INSERT INTO ACC(AMOUNT_TD,ACC_CODE,EN_DATE,FO_TYPE,PART) VALUES(AMT,ACC1,SYSDATE,'JV','CASH
    PERCENTAGE FOR '||45457);
    STANDARD.COMMIT;STANDARD.COMMIT;STANDARD.COMMIT;
    UPDATE FOOD.MEMBER_DET SET AMOUNT=C1 WHERE USER_ID=UIDAND C_COD=2;
    STANDARD.COMMIT;STANDARD.COMMIT;STANDARD.COMMIT;
    END IF;
    end;the values receiving in insert statement is correct values.
    how to resolve this?
    Thanks skud...

    Check for too many rows or no data found exception.
    And also check the number of rows either inserted or updated.
    Something like this:
    create or replace PROCEDURE PAYMENT(AMT NUMBER,UID NUMBER) IS
      AMT1  NUMBER;
      AMT   NUMBER;
      PD    VARCHAR2(100);
      C1    NUMBER;
      PER   NUMBER;
      ACC1  VARCHAR2(15);
      CF    NUMBER;
      CRF   NUMBER;
      ACC2  VARCHAR2(15);
    begin
      begin
        SELECT  PAY_DESC
        INTO PD
        FROM SUB.PAYMENT_TY
        WHERE ORD=0;
        exception
          when too_many_rows then
            dbms_output.put_line('Too many rows in first SELECT');
          when no_data_found then
            dbms_output.put_line('No data found in first select');
      end;
      begin
        SELECT NVL(AMOUNT,0)
        INTO C1
        FROM FOOD.MEMBER
        WHERE LTRIM(RTRIM(UPPER(NAME))) LIKE LTRIM(RTRIM(UPPER(PD)))
        AND USER_ID=UID;
        exception
          when too_many_rows then
            dbms_output.put_line('Too many rows in second SELECT');
          when no_data_found then
            dbms_output.put_line('No data found in second select');
      end;
      IF NVL(C1,0)>AMT THEN /*CASH*/
        C1:=C1-AMT;
        begin
          SELECT ACCOUNT_CODE
          INTO ACC1
          FROM SUB.MASTER
          WHERE PAY_CODE=2;
          exception
            when too_many_rows then
              dbms_output.put_line('Too many rows in third SELECT');
            when no_data_found then
              dbms_output.put_line('No data found in third select');
        end;
        INSERT INTO ACC(AMOUNT_TD,ACC_CODE,EN_DATE,FO_TYPE,PART) VALUES(AMT,ACC1,SYSDATE,'JV','CASH PERCENTAGE FOR '||45457);
        dbms_output.put_line('Insert ' || sql%rowcount);
        COMMIT;
        UPDATE FOOD.MEMBER_DET SET AMOUNT=C1 WHERE USER_ID=UIDAND C_COD=2;
        dbms_output.put_line('Update ' || sql%rowcount);
        commit;
      END IF;
    end;
    /UNTESTED!!

  • Custom event handler not executing

    Hello.
    I'm to set an event handler to execute after a user gets added a role. I have my plugin.zip file like this:
    -lib/(myjar).jar
    -plugin.xml
    Plugin.xml looks like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    <oimplugins>
         <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
              <plugin pluginclass="com.uti.oim.events.SqlRoleHandler" version="1.0" name="SqlRoleHandler" />
         </plugins>
    </oimplugins>
    Placed it in the plugins directory in my dev environment.
    customhandler.xml looks like this:
    <?xml version='1.0' encoding='UTF-8'?>
    <eventhandlers>
         <action-handler class="com.uti.oim.events.SqlRoleHandler" stage="postprocess" sync="TRUE" entity-type="RoleUser" operation="CREATE" name="SqlRoleHandler" order="1000"/>
    </eventhandlers>
    What am I doing wrong? Thanks.

    I ran into an issue with event hanlders in 11g. This might apply to yours. I was unable to create both a preprocess and postprocess task on the same object. It always threw an error on the postprocess class that it can't be case as a pre process event handler. So the solution was removal of all preprocess and just go with postprocess and use the EntityManager class to make the updates to not trigger another update. We had to process post-create user tasks for bulk recon, and could not process it in pre, so our only option was to move it all to post.
    -Kevin

  • Hi frnds this is the code for dynamic creation of users in plsql but these statements r not executing so pls help me for this error

    DECLARE
    n NUMBER;
    BEGIN
    n:=1;
    WHILE(n<=10)
    LOOP
    CREATE user EM||n IDENTIFIED BY KLU;
    GRANT CREATE SESSION,GRANT ANY PRIVILEGE TO EM||n;
    COMMIT;
    n:=n+1;
    END LOOP;
    END;

    Hi,
         Here is the dynamic query for creating user and to give grants to user,
    DECLARE
       n         NUMBER;
       cr_user   VARCHAR2 (300);
       gr_user   VARCHAR2 (300);
    BEGIN
       n := 1;
       WHILE (n <= 10)
       LOOP
          cr_user := 'CREATE user EM' || n || ' IDENTIFIED BY KLU';
          gr_user := 'GRANT CREATE SESSION,GRANT ANY PRIVILEGE TO EM' || n || '';
          EXECUTE IMMEDIATE cr_user;
          EXECUTE IMMEDIATE gr_user;
          n := n + 1;
       END LOOP;
    END;
    Edited: Removed When OTHERS Exception Handling from Code.
    Cheers!

  • Collection with bulk collect , statement is not executed..

    DECLARE
              CURSOR cur_upt IS SELECT ts.user_id, ts.lot_id, ts.ml_ac_no, ts.td_prs_dt, ts.unit_cost, ts.cost_basis
              FROM tb_xop_sharelot_frac_snap fs, tb_xop_sharelot ts
              WHERE fs.lot_id=ts.lot_id AND fs.user_id=ts.user_id;
    TYPE tx_tab IS TABLE OF tb_xop_sharelot.user_id%TYPE;
    ltab tx_tab;
    TYPE tx_tab1 IS TABLE OF tb_xop_sharelot.lot_id%TYPE;
    ltab1 tx_tab1;
    TYPE tx_tab2 IS TABLE OF tb_xop_sharelot.ml_ac_no%TYPE;
    ltab2 tx_tab2;
    TYPE tx_tab3 IS TABLE OF tb_xop_sharelot.td_prs_dt%TYPE;
    ltab3 tx_tab3;
    TYPE tx_tab4 IS TABLE OF tb_xop_sharelot.unit_cost%TYPE;
    ltab4 tx_tab4;
    TYPE tx_tab5 IS TABLE OF tb_xop_sharelot.cost_basis%TYPE;
    ltab5 tx_tab5;
    BEGIN
              INSERT INTO tb_xop_sharelot_frac_snap (lot_id, jemq_num, lot_qy, activity_type, LOT_SL_CREATE_DT,
                   LOT_SL_CLOSE_DT, lot_status, frac_recon, hist_flag, create_dt, user_id)
                   (SELECT lot_id, jemq_num, lot_qy, activity_type, LOT_SL_CREATE_DT,
                   LOT_SL_CLOSE_DT,lot_status, frac_recon, hist_flag, create_dt, user_id FROM tb_xop_sharelot_fraction);
              OPEN Cur_upt;
    LOOP
              FETCH Cur_upt BULK COLLECT INTO ltab, ltab1, ltab2, ltab3, ltab4, ltab5 LIMIT 5000;
    EXIT WHEN cur_upt%NOTFOUND;
              END LOOP;
              CLOSE cur_upt;
              FORALL i IN ltab.FIRST..ltab.LAST
    UPDATE tb_xop_sharelot_frac_snap SET ml_ac_no=ltab2(i)/*, td_prs_dt=ltab3(i),
              unit_cost=ltab4(i), cost_basis=ltab5(i)*/ WHERE user_id=ltab(i) AND lot_id=ltab1(i);
              COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLCODE|| ' ' ||SQLERRM);
    END;

    This is the third question you have posted just putting one short subject and only posting code not formatted.
    I suggest you to read SQL and PL/SQL FAQ and avoid posting your question in this way as they will be ignored.
    Please:
    a) post sample data
    b) post your code formatted
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    c) explain what problem you are facing in details (including oracle errors)
    d) explain the logic you want to have
    e) post your expected output.
    Regards.
    Al

  • ORA-24338

    Hi,
    I created a simple procedure in one database and tried to access it from another as follows:
    DB: abcq
    user: abc
    create or replace procedure myproc (pcat number, src sys_refcursor)
    as
    begin
    open src for select cat_id "ID", cat_name "Category" from category where cat_id = pcat or pcat is null;
    end;
    I tested it in abcq:
    var bc refcursor;
    exec myproc(212,:bc);
    print bc;
    PL/SQL procedure successfully completed.
    BC
    ID Category
    *212 Studies*
    I then did the following in another database:
    DB: abcd
    user abc
    created a database link dbq for user abc in db abcq.
    tested the link:
    select cat_id, cat_name from category@dbq where cat_id = 212;
    CAT_ID CAT_NAME
    *212 Studies*
    Then I tried to execute the procedure I created remotely from abcd:
    var bc refcursor;
    exec myproc@dbq(212,:bc);
    print bc;
    PL/SQL procedure successfully completed.
    ERROR:
    ORA-24338: statement handle not executed
    no rows selected
    All this was in SQL*Plus.
    I tried Oracle SQL Developer environment. In that case, the procedure was successfully completed and when I printed bc, it gave me the following:
    BC
    ID     Category
    It gave the correct column headings, but no data!
    I scoured the web, but was unable to find any answer. One thing I did notice in one of the Oracle documentation sites, and I paraphrase: '... any remote procedure call is assumed to be for an update...' which I thought was strange. So, my questions are:
    Is it possible to execute a procedure that returns a cursor remotely and can we access the data in that cursor? If so, what am I doing wrong?
    Thank you.
    Vinod
    Edited by: user2808224 on Aug 18, 2011 9:40 AM
    Edited by: user2808224 on Aug 18, 2011 9:43 AM

    user2808224 wrote:
    Hi,
    I created a simple procedure in one database and tried to access it from another as follows:
    DB: abcq
    user: abc
    create or replace procedure myproc (pcat number, src sys_refcursor)
    as
    begin
    open src for select cat_id "ID", cat_name "Category" from category where cat_id = pcat or pcat is null;
    end;
    I tested it in abcq:
    var bc refcursor;
    exec myproc(212,:bc);
    print bc;
    PL/SQL procedure successfully completed.
    BC
    ID Category
    *212 Studies*
    I then did the following in another database:
    DB: abcd
    user abc
    created a database link dbq for user abc in db abcq.
    tested the link:
    select cat_id, cat_name from category@dbq where cat_id = 212;
    CAT_ID CAT_NAME
    *212 Studies*
    Then I tried to execute the procedure I created remotely from abcd:
    var bc refcursor;
    exec myproc@dbq(212,:bc);
    print bc;
    PL/SQL procedure successfully completed.
    ERROR:
    ORA-24338: statement handle not executed
    no rows selected
    All this was in SQL*Plus.
    I tried Oracle SQL Developer environment. In that case, the procedure was successfully completed and when I printed bc, it gave me the following:
    BC
    ID     Category
    It gave the correct column headings, but no data!
    I scoured the web, but was unable to find any answer. One thing I did notice in one of the Oracle documentation sites, and I paraphrase: '... any remote procedure call is assumed to be for an update...' which I thought was strange. So, my questions are:
    Is it possible to execute a procedure that returns a cursor remotely and can we access the data in that cursor? If so, what am I doing wrong?
    Thank you.
    Vinod
    Edited by: user2808224 on Aug 18, 2011 9:40 AM
    Edited by: user2808224 on Aug 18, 2011 9:43 AMhttp://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/cursor_variable.htm#LNPLS01312
    You can use a cursor variable in a server-to-server remote procedure call (RPC) only if the remote database is not an Oracle Database accessed through a Procedural Gateway.
    "

  • Error ora-24338 happened  when change data source on crystal report

    Hi Guys:
    I made a report on my test envariment (this report involve stored procedure and it return a ref cursor from oracle database to the report). after i test it, i decided to move this report to the production database. However when i updated the database location, it shows me the following error:
    database connector error: 'ORA-24338': statement handle not executed [database wender code: 24338]
    then it shows:
    some tables could not be replaced, as no match was found in the new data source. please spacify the table required for any unmodified tables.
    then it shows:
    database connection error
    all the tables and code in test database and production database are same.
    anyone can help me?
    thanks
    Howard

    after you went to database
    set datasource location
    updated it.
    did a mapping box come up
    did you then verify the database to pull in the new records or tables?
    i would run the query on the server to see if it returns values.
    you may also need to set your overqualified table name
    database
    set datasource
    locate the table or sp in the top box
    the + next to the sp or table
    click
    open properities +
    overqualified table name F2
    enter the table or sp in there
    then verify your database and try to run against the prod server

Maybe you are looking for