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

Similar Messages

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

  • 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

  • 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

  • Ora 24338  error.  in pro*c  while executing the report at the second time

    This is one solved So thanks
    S
    Edited by: Oracle beginner on Feb 11, 2010 4:07 PM

    Hi Akshay,
    I guess the error occurs since you made a change to the Data target - possibly removing/replacing a info-object.
    Try this sequence:
    1. Open the query in change mode and resave it.Now execute it and check.
    2. If error still occurs then try executing the query in RSRT and check the error and analyze or post here.
    Hope this helps.
    Bye
    Dinesh

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

  • SQL Loader Error ORA-03113

    Hi All,
    I am getting the following error when running sql loader. The SQL Loader Version we are using is Release 9.2.0.5.0. I am using the DIRECT option for SQL Loader as well. Thanks in advance.
    SQL*Loader-961: Error calling once/load finishing for table "TABLE_EX"
    ORA-03113: end-of-file on communication channel
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
    ORA-03114: not connected to ORACLE
    SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
    ORA-24338: statement handle not executed

    You hit Bug 3531336
    Run the script catcio.sql from $ORACLE_HOME/rdbms/admin directory.
    Run this in sys schema.
    And then load the data with sqlloader.

  • Case statement in 9i/8i

    I want to be able to run a select conditionally. I have gotten this far.
    SQL> select
    2 (case
    3 when (select count(*) from all_objects
    4 where owner = 'SYS' and object_name = 'DBA_REGISTRY') >= 1
    5 then
    6 ( select rpad(substr(comp_name,1,50),50,' ')||' '||rpad(status,15,' ')||' '||substr(version,1,10) from dba_registry)
    7 else
    8 ( select 'dba_registry does not exist.' from dual)
    9 end)
    10 from dual;
    ( select rpad(substr(comp_name,1,50),50,' ')||' '||rpad(status,15,' ')||' '||substr(version,1,10) from dba_registry)
    ERROR at line 6:
    ORA-00942: table or view does not exist
    The 'dba_registry' does not exist in 8i but does in 9i.
    When it is run in 9i the error becomes:
    ORA-1427 Singe-row subquery returns more than one row.
    Basically I want to check for existance of an object and perform some action (not to difficult in PL/SQL using execute immediate - unless the action is to select and return multiple rows) using code that will execute on both 8i & 9i databases.
    Any pointers please?

    Env = 9i
    undefine c
    set serveroutput on size 100000
    connect / as sysdba
    grant select on dba_registry to ops$oracle;
    grant select on dba_objects to ops$oracle;
    connect /
    create or replace package vs_types
    as
    type cursorType is ref cursor;
    end;
    show errors
    create or replace procedure vs_getdata ( p_cursor in out vs_types.cursorType)
    is
    findresult number;
    dba_registry1 varchar2(20);
    begin
    dba_registry1:='dba_registry';
    select count(*) into findresult from dba_objects where owner = 'SYS' and object_name = 'DBA_REGISTRY';
    dbms_output.put_line('findresult='||findresult);
    dbms_output.put_line('dba_registry1='||dba_registry1);
    if findresult > 0
    then
    open p_cursor for
    select rpad(substr(comp_name,1,50),50,' ')||' '||rpad(status,15,' ')||' '||substr(version,1,10) from dba_registry;
    else
    open p_cursor for
    select 'Dba_registry does not exist in 8i.' from dual;
    end if;
    end;
    show errors
    variable c refcursor
    exec vs_getdata(:c)
    print c
    drop package vs_types;
    drop procedure vs_getdata;
    ~
    ~
    ~
    ~
    ~
    "x3a.sql" 37 lines, 989 characters
    SQL> @x3a
    Connected.
    Grant succeeded.
    Grant succeeded.
    Connected.
    Package created.
    No errors.
    Procedure created.
    No errors.
    PL/SQL procedure successfully completed.
    RPAD(SUBSTR(COMP_NAME,1,50),50,'')||''||RPAD(STATUS,15,'')||''||SUBSTR(VERSIO
    Oracle9i Catalog Views VALID 9.2.0.4.0
    Oracle9i Packages and Types VALID 9.2.0.4.0
    Package dropped.
    Procedure dropped.
    SQL> exit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    JServer Release 9.2.0.4.0 - Production
    change env to 8i
    ==============
    ora@misdev01:~/vins 149 % sqlplus /
    SQL*Plus: Release 8.1.7.0.0 - Production on Fri Feb 4 18:37:09 2005
    (c) Copyright 2000 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 8.1.7.4.0 - 64bit Production
    SQL> @x3a
    Connected.
    grant select on dba_registry to ops$oracle     <(i dont care if this errors in 8i)
    ERROR at line 1:
    ORA-00942: table or view does not exist
    Grant succeeded.
    Connected.
    Package created.
    No errors.
    Warning: Procedure created with compilation errors.
    Errors for PROCEDURE VS_GETDATA:
    LINE/COL ERROR
    13/2 PL/SQL: SQL Statement ignored
    13/103 PLS-00201: identifier 'DBA_REGISTRY' must be declared
    BEGIN vs_getdata(:c); END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00905: object OPS$ORACLE.VS_GETDATA is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "c"
    Package dropped.
    Procedure dropped.
    If the select from dba_registry can be put inside a 'execute immediate' , 8i will ignore it during the compile and it runs ok, BUT
    I cannot fathom how to get a 'execute immediate' to return the data into p_cursor in 9i.
    Maybe something like:
    execute immediate('open p_cursor for select rpad(substr(comp_name,1,50),50,'' '')||'' ''||rpad(status,15,'' '')||'' ''||substr(version,1,10) from dba_registry');
    Please help.

  • SQL*Loader and multiple files

    Hello, am tasked with loading tables with 21+ million rows. Will SQL*Loader perform better with one large file or many smaller files? Is there any ideal file size for optimal performance? Thank you
    David

    Don, when I tried to loada 21M row table using direct, I get the following messages:
    Record 2373: Rejected - Error on table STAGE_CUSTOMER.
    ORA-03113: end-of-file on communication channel
    SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
    ORA-03114: not connected to ORACLE
    SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
    ORA-24338: statement handle not executed
    Here is the SQL*Loader log:
    SQL*Loader: Release 9.2.0.1.0 - Production on Thu Apr 26 15:38:29 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Control File: stage_customer.ctl
    Character Set UTF8 specified for all input.
    First primary datafile stage_Customer_20070301.csv has a
    utf8 byte order mark in it.
    Data File: stage_Customer_20070301.csv
    Bad File: stage_Customer_20070301.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 1000
    Continuation: none specified
    Path used: Direct
    Silent options: FEEDBACK
    Table STAGE_CUSTOMER, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    ROW_ID SEQUENCE (MAX, 1)
    CUSTOMER_ACCT_NUM FIRST * , O(") CHARACTER
    IS_DELETED NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:Is_Deleted) IN ('FALSE','0') THEN 0 ELSE 1 END"
    NAME_PREFIX NEXT * , O(") CHARACTER
    FIRST_NAME NEXT * , O(") CHARACTER
    MIDDLE_NAME NEXT * , O(") CHARACTER
    LAST_NAME NEXT * , O(") CHARACTER
    NAME_SUFFIX NEXT * , O(") CHARACTER
    NICK_NAME NEXT * , O(") CHARACTER
    ALT_FIRST_NAME NEXT * , O(") CHARACTER
    ALT_LAST_NAME NEXT * , O(") CHARACTER
    MARKETING_SOURCE_ID NEXT * , O(") CHARACTER
    HOME_PHONE NEXT * , O(") CHARACTER
    WORK_PHONE NEXT * , O(") CHARACTER
    MOBILE_PHONE NEXT * , O(") CHARACTER
    ALTERNATE_PHONE NEXT * , O(") CHARACTER
    EMAIL_ADDR NEXT * , O(") CHARACTER
    ALT_EMAIL_ADDR NEXT * , O(") CHARACTER
    BIRTH_DATE NEXT * , O(") CHARACTER
    SQL string for column : "TRUNC(TO_DATE(:Birth_Date, 'MM/DD/YYYY HH24:MI:SS'))"
    SALES_CHANNEL_ID NEXT * , O(") CHARACTER
    SQL string for column : "decode(:Sales_Channel_id,NULL,NULL,NULL)"
    ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
    ALT_ASSOCIATE_NUMBER NEXT * , O(") CHARACTER
    UPDATE_LOCATION_CD NEXT * , O(") CHARACTER
    UPDATE_DATE NEXT * , O(") CHARACTER
    SQL string for column : "TRUNC(TO_DATE(:Update_Date, 'MM/DD/YYYY HH24:MI:SS'))"
    CUSTOMER_LOGIN_NAME NEXT * , O(") CHARACTER
    DISCOUNT_CD NEXT * , O(") CHARACTER
    DISCOUNT_PERCENT NEXT * , O(") CHARACTER
    BUSINESS_NAME NEXT * , O(") CHARACTER
    POS_TAX_FLAG NEXT * , O(") CHARACTER
    POS_TAX_PROMPT NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_TAX_PROMPT) IN ('FALSE','0') THEN 0 ELSE 1 END"
    POS_DEFAULT_TAX_ID NEXT * , O(") CHARACTER
    POS_TAX_ID_EXPIRATION_DATE NEXT * , O(") CHARACTER
    POS_AUTHORIZED_USER_FLAG NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_AUTHORIZED_USER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
    POS_ALLOW_PURCHASE_ORDER_FLAG NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:POS_ALLOW_PURCHASE_ORDER_FLAG) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ADDRESS1 NEXT * , O(") CHARACTER
    ADDRESS2 NEXT * , O(") CHARACTER
    ADDRESS3 NEXT * , O(") CHARACTER
    CITY NEXT * , O(") CHARACTER
    STATE_CD NEXT * , O(") CHARACTER
    POSTAL_CD NEXT * , O(") CHARACTER
    COUNTRY_CD NEXT * , O(") CHARACTER
    ALLOW_UPDATE NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:ALLOW_UPDATE) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ACTION_CODE NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN UPPER(:action_code) IN ('FALSE','0') THEN 0 ELSE 1 END"
    ACCOUNT_TYPE_ID NEXT * , O(") CHARACTER
    LOCALE_CD NEXT * , O(") CHARACTER
    SQL string for column : "CASE WHEN :Locale_CD IS NOT NULL AND :Locale_CD LIKE '__-__' THEN :Locale_CD ELSE 'en-US' END"
    IS_READY_FOR_PROCESSING CONSTANT
    Value is '1'
    IS_BUSINESS CONSTANT
    Value is '0'
    HAD_ERRORS CONSTANT
    Value is '0'
    Record 2373: Rejected - Error on table STAGE_CUSTOMER.
    ORA-03113: end-of-file on communication channel
    SQL*Loader-926: OCI error while uldlfca:OCIDirPathColArrayLoadStream for table STAGE_CUSTOMER
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    SQL*Loader-925: Error while uldlgs: OCIStmtExecute (ptc_hp)
    ORA-03114: not connected to ORACLE
    SQL*Loader-925: Error while uldlgs: OCIStmtFetch (ptc_hp)
    ORA-24338: statement handle not executed
    Table STAGE_CUSTOMER:
    0 Rows successfully loaded.
    1 Row not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Bind array size not used in direct path.
    Column array rows : 5000
    Stream buffer bytes: 256000
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 3469
    Total logical records rejected: 1
    Total logical records discarded: 0
    Direct path multithreading optimization is disabled
    Run began on Thu Apr 26 15:38:29 2007
    Run ended on Thu Apr 26 15:38:30 2007
    Elapsed time was: 00:00:01.18
    CPU time was: 00:00:00.32

  • Error in dynamic cursor::

    hi experts
    please help me for this error
    In this code the cursor conditions are not appending to the query
    so when i am executing the result it is displaying the error
    can you help me on this
    SQL> CREATE OR REPLACE PROCEDURE test_dynamic_detailed_rpt (
      2     v_typ             IN       VARCHAR2,
      3     v_initiator   IN       VARCHAR2,
      4     p_rc                  OUT      sys_refcursor
      5  )
      6  IS
      7     v_sql   VARCHAR2(32767);
      8  BEGIN
      9     v_sql := 'SELECT  COUNT(*) FROM  txnlg tl WHERE ';
    10
    11      v_sql := v_sql||'tl.typ = ''1''';
    12
    13
    14           FOR j IN (SELECT tc.tgid, tc.tranid, tc.reqtype
    15                       FROM txnccde tc
    16                      WHERE tc.actstatus = 'Y'
    17                        AND tc.txndesc = v_typ)
    18           LOOP
    19              IF LENGTH (j.tgid) < 4
    20              THEN
    21                 v_sql := v_sql || ' OR ''UP''||J.tgid';
    22                 --'''|| v_typ|| ''')';
    23              ELSE
    24                 v_sql := v_sql || ' OR   J.tgid';
    25              END IF;
    26           END LOOP;
    27
    28     DBMS_OUTPUT.PUT_LINE(v_sql);
    29  END;
    30  /
    Procedure created.
    SQL>
    SQL> set serveroutput on;
    SQL>
    SQL> Var  p_rc refcursor;
    SQL>
    SQL> BEGIN
      2  test_dynamic_detailed_rpt('ALL','C',:p_rc);
      3  END;
      4  /
    SELECT  COUNT(*) FROM  txnlg tl WHERE tl.typ = '1'
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print p_rc;
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "p_rc"
    SQL>

    980560 wrote:
    I have coded that cursor . but the following error is occuring while
    executing the cursor .please help me to resolve this .
    CREATE OR REPLACE PROCEDURE test_dynamic_detailed_rpt (
    v_typ IN VARCHAR2,
    v_initiator IN VARCHAR2,
    p_rc OUT sys_refcursor
    IS
    v_sql VARCHAR2 (32767);
    BEGIN
    v_sql := 'SELECT COUNT(*) FROM txnlg tl WHERE ';
    v_sql := v_sql || 'tl.typ = ''1''';
    FOR j IN (SELECT tc.tgid, tc.tranid, tc.reqtype
    FROM txnccde tc
    WHERE tc.actstatus = 'Y')
    LOOP
    IF LENGTH (j.tagid) < 4
    THEN
    v_sql :=
    v_sql || ' OR ' || 'tl.txntype =' ||''''|| 'AP' ||j.tgid
    || '''';
    ELSE
    v_sql := v_sql || 'OR ' || 'tl.txntype =' ||''''||j.tgid||'''';
    END IF;
    END LOOP;
    DBMS_OUTPUT.put_line (v_sql);
    OPEN p_rc FOR v_sql;
    END;
    Procedure created.
    SQL>
    SQL> set serveroutput on;
    SQL>
    SQL> Var p_rc refcursor;
    SQL>
    SQL> BEGIN
    2 test_dynamic_detailed_rpt('ALL','C',:p_rc);
    3 END;
    4 /
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at P_DETAILED_REPRT, line 226
    ORA-06512: at line 2
    That error does not relate to the code you've posted. P_DETAILED_REPORT is not the name of your procedure.
    Please post the error you get from running the code shown. I suspect you are trying to build an SQL statement that is too large for the v_sql variable, but we don't have your data to be able to tell.
    I'll repeat what I said earlier:
    Perhaps if you posted some examples of your tables and data, and explained what output you are trying to get, we could help you to write it as a static SQL instead.Read this: {message:id=9360002}
    You'll find that the people who get the quickest answers around here are the ones who ask their questions properly with sufficient information and example data. If you keep people guessing what you want, then they often tend to get bored and go elsewhere.... so the choice is yours... help us to help you.

  • No values returned by refcursor ....

    Hi
    1) I have created one procedure which returns refcursor
    2) at sql prompt i have created variable of type refcursor
    3) then I execute procedure by passing this variable
    4) then i tried printing
    i.e
    SQL> print :jc11
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "jc11"
    my query is:-
    Is the above error becoz of no records returned by cursor ????
    ( I have checked the select statement which is used in procedure which is not returning any records.)
    Thanks and Regards
    JC

    example:
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function myrefc return sys_refcursor is
      2    v_rc sys_refcursor;
      3  begin
      4    OPEN v_rc FOR 'SELECT 1 as tom, 2 as fred from dual';
      5    RETURN v_rc;
      6* end;
    SQL> /
    Function created.
    SQL> var x refcursor;
    SQL> exec :x := myrefc;
    PL/SQL procedure successfully completed.
    SQL> print x
           TOM       FRED
             1          2
    SQL>

  • PLS-00201 error occurs when batching a stored procedure in SQL*Plus

    I have a batch file to run a stored procedure and spool the results to file. When I enter the commands manually in sql*plus the output works fine and my results are spooled to the output file. But when I run the same commands in the batched script I get an error.
    Any ideas?
    Stored Procedure:
    create or replace procedure MMP( p_cursor in out SYS_REFCURSOR)
    as
    begin
    open p_cursorfor select name, id from table;
    end;
    batch file 1:
    sqlplus -S user/pw@REPORTDV @sp_output_spooled.sql
    script file sp_output_spooled.sql
    Pasting these commands directly to the SQL*Plus command prompt spools the result set to file as expected.
    set colsep '|'
    set echo off
    set feedback off
    set termout off
    set heading off
    set linesize 9000
    set pagesize 0
    set trimspool on
    set headsep off
    spool output.TXT
    var rc refcursor
    execute MMP(:rc)
    print rc
    spool off
    exit
    The errors printed to output.TXT file after the batch is run and error occurs:
    BEGIN MMP(:rc); END;
    ERROR at line 1:
    ORA-06550: line 1, column 8:
    PLS-00201: identifier 'MMP' must be declared
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored
    ERROR:
    ORA-24338: statement handle not executed
    SP2-0625: Error printing variable "rc"

    Hi,
    Your code worked fine for me.
    Is MMP procedure owned by the same user that is running the batch file or does it have proper privileges and synonym?
    vr,
    Sudhakar

  • Populate a REF CURSOR from regular cursor...

    Hi all,
    I apologize if the answer to this is somewhere...I've been looking on the web for sometime and can't find an answer to the following problem. I have a Significant Events database that contains network based issues and problems. As problems are detected on the network an SE is issued and published. As the SE records are updated, NEW records are entered into the table and "linked" back to the original. Each update results in a new row. Thus, an SE with two updates would have a total of 3 lines. When the SE gets closed (set the column CLOSED to SYSDATE), only the "original" SE is closed, any updates are left open...aka, the CLOSED column is left null.
    That said, I need a way to get the original and/or latest updated SE rows from the table. Thus, I am trying to use a PL/SQL package. The PL/SQL "must" return a REF CURSOR as the results are being passed to a client process.
    My initial approach was within a PL/SQL procedure, I have an SQL statement that returns the SE originals. Once in that cursor I need to do the following:
    - Attempt to fetch any linked SE rows.
    - if no rows then
    - add the original to the REF CURSOR.
    - else
    - find latest SE update
    - add latest SE update to REF CURSOR.
    - end if
    My Question is : How do I manually "add" a row to a REF CURSOR?
    If this is not possible, is there a way to populate a REF CURSOR from maybe another construct like:
    TYPE ian_se_record is RECORD (
    se_id number
    ,linked_se_id number
    ,submitted date
    ,updated date
    ,closed date
    ,segroup varchar2(150)
    ,incident_start_time varchar2(150)
    ,business_units_affected varchar2(150)
    ,officenum varchar2(1500)
    ,sedetails varchar2(4000)
    TYPE ian_se_table is table of ian_se_record index by binary_integer;
    With the above construct I could:
    - Fill ian_se_table with the process described above.
    - And finally select off ian_se_table into the REF CURSOR?
    Any help would be greatly appreciated,
    adym

    Hi michaels,
    I've put your solution in place, but can't seem to get it to run. The two types were moved out of the package and into real types as you said. Here's the function, for brevity, I've remove some of the less important code:
    function ian_se_fetch return sys_refcursor
    is
        p_csr_events            sys_refcursor;
        cursor csr_items is
            select
                 se_id
        ...removed for brevity...
        /* END : csr_items  */
        ian_se_row     ian_se_record;
        ian_se_tbl     ian_se_table;
        l_lng_index    number;
        l_lng_linked   number;
        l_lng_id       number;
    begin
         * OPEN : Open the main cursor of originals...
        for the_item in csr_items loop
             * CHECK : Check for any updates to the original...
            l_lng_linked := 0;
            select count(*)
            into l_lng_linked
            from sig_se_t src
            where src.linked_se_id = the_item.se_id;
            l_lng_id := 0;    /* reset the se-id    */
            /* SE original...no linked records yet.    */
            if ( l_lng_linked = 0 ) then
                l_lng_id := the_item.se_id;
            /* SE updates...one or more updates are present.    */
            else
                begin
                    select
                         se_id
                    into l_lng_id
                    from sig_se_t src
                    where src.linked_se_id = the_item.se_id
                      and rownum = 1
                    order by updated desc; /* latest update    */
                exception
                    when too_many_rows then
                        l_lng_id := the_item.se_id;
                    when others then
                        l_lng_id := 0;
                end;
            end if;
            if ( l_lng_id != 0 ) then
                select
                     se_id
                    ,linked_se_id
                    ,submitted
                    ,updated
                    ,closed
                    ,segroup
                    ,incident_start_time
                    ,business_units_affected
                    ,officenum || decode( nvl(impact,'1')
                                      ,'1',''
                                      ,decode(impact
                                          ,'NA', ''
                                          ,':' || impact
                                  )                           impact
                    ,sedetails
                into ian_se_row.se_id
                    ,ian_se_row.linked_se_id
                    ,ian_se_row.submitted
                    ,ian_se_row.updated
                    ,ian_se_row.closed
                    ,ian_se_row.segroup
                    ,ian_se_row.incident_start_time
                    ,ian_se_row.business_units_affected
                    ,ian_se_row.officenum
                    ,ian_se_row.sedetails
                from sig_se_t src
                where src.se_id = l_lng_id;
                l_lng_index := nvl(ian_se_tbl.last,0)+1;
                ian_se_tbl(l_lng_index).se_id                   := ian_se_row.se_id;
                ian_se_tbl(l_lng_index).linked_se_id            := ian_se_row.linked_se_id;
                ian_se_tbl(l_lng_index).submitted               := ian_se_row.submitted;
                ian_se_tbl(l_lng_index).updated                 := ian_se_row.updated;
                ian_se_tbl(l_lng_index).closed                  := ian_se_row.closed;
                ian_se_tbl(l_lng_index).segroup                 := ian_se_row.segroup;
                ian_se_tbl(l_lng_index).incident_start_time     := ian_se_row.incident_start_time;
                ian_se_tbl(l_lng_index).business_units_affected := ian_se_row.business_units_affected;
                ian_se_tbl(l_lng_index).officenum               := ian_se_row.officenum;
                ian_se_tbl(l_lng_index).sedetails               := ian_se_row.sedetails;
            end if;
        end loop;
         * REF CURSOR : Open the ref cursor on the dataset...
        if ( nvl(ian_se_tbl.last,0) = 0 ) then
            p_csr_events := null;
        else
            open p_csr_events for
            select *
            from table (cast ( ian_se_tbl as ian_se_table ));
        end if;
        return p_csr_events;
    end;Here's the test. I keep getting the same error ORA-06530:
    SQL> variable v refcursor;
    SQL> exec :v:=pkg_ian.ian_se_fetch;
    BEGIN :v:=pkg_ian.ian_se_fetch; END;
    ERROR at line 1:
    ORA-06530: Reference to uninitialized composite
    ORA-06512: at "N0002501.PKG_IAN", line 131
    ORA-06512: at line 1
    SQL> print v
    ERROR:
    ORA-24338: statement handle not executedOther things I tried:
    - The ian_se_fetch() function was a procedure using an in out parameter...same error.
    - Wrote a small anonymous block and tried to LOOP/FETCH. Same ORA-06530 error.
    P.S. Line 131 of pkg_ian is the SELECT ... INTO ian_se_row.se_id, ...
    Any help would be greatly appreciated,
    tia,
    adym
    Message was edited by:
    alink

Maybe you are looking for

  • ITunes takes hours to import CDs and doesn't playback properly

    I recently bought four CDs (all by the same artist) and only one of the four will import to iTunes.  The first CD imported in about five minutes, and there were no problems. Despite iTunes still recognising the track titles and other info, the other

  • Passing parameters to run() method of a thread?

    hello ppl is it possible to pass any parameters to the run() method of a thread moreover if i create a thread foo the only method that can run is run() ? i know that i can have more methods and just call them via run(). i mean that if i create the co

  • CanoScan N670U flatbed scanner, Will it run in LION

    I have a Canon CanoScan N670U flatbed scanner. Does anyone have an idea if someone has new drivers or if there in the works so it will work with Mac OS x 10.7.1 Lion? Or is this Canon scanner just another paper weight? Thanks Ed............

  • CCM   QUERIES

    Hi All,    We are running on SRM 4.0(Classic Scenario).We are starting with the CCM 2.0 configuration now.We have installed both CAT & CSE on the same client as SRM.Regarding the initial configuration,I wanted some clarifications to my queries:- 1> T

  • Could anyone suggest me for Month end closing!!!!!!!!!!

    What does closing subledger and other ledgers mean in month end closing. I am new , I would appreciate if anyone helps with monthend closing .I will assign you points.Thanks in advance.