Cursor variable - long process to populate

Dear all
I have an ASP.NET 2.0 application calling an Oracle 9i stored procedure.
The stored procedure creates and populates some tables. I then construct some SQL which I use in the following statement:
OPEN report_data FOR sql_string;
(report_data is a REF CURSOR that is passed back to the calling application as an output variable.)
I then attempt to drop the tables used in the sql_string query but I'm getting an "object not found" error - presumably because the tables are being dropped while the query is still running. Without the DROP statements everything works fine - except that I'm left with the spurious tables.
Question is, is there some way I can halt execution until I know that the query has finished (and the cursor populated)? My current workaround is to call a separate procedure from the ASP.NET app afterwards to do the clean up, and that can't be right.
Any help greatly appreciated.
Stuart

As I understand your problem, you need to deal with dynamic SQL and a dynamic projection.
A SQL basically has the following structure:
SELECT
  <<projection>>
FROM
  <<selection>>Dealing with dynamic projections are complex. The projection of a SQL must be static - once that SQL is being executed, it cannot start to change its projection.
For example, you cannot write a SQL with a CASE statement that returns 5 columns for case 1 and 10 columns for case 2.
The typical example is a pivot. When you pivot data using plain SQL, you need to hard code each and every pivot column into the SQL projection. You cannot create a generic SQL that can be used for any pivot - as such a SQL cannot (at run-time) determine and create the required pivot columns.
What is possible is for the SQL, at parsing time, to tell the SQL Engine what projection it is planning to return. So when the SQL was written, the projection is unknown. At run-time, when it is parsed, the SQL can look at run-time parameters and then decide how its projection will look like. And the SQL Engine /Parser will be happy with that - as once that SQL starts executing that projection will be static.
What is needed for such an approach is a RTTI interface - a Run Time Type Information interface where the SQL engine can ask the SQL, "hey, what columns are you planning to throw at me via your projection when I'm going to execute you?". And the SQL being able to dynamically determine the columns and their names and their data types and return that data to the SQL engine.
This is what the "RTTI implementation" of a pipelined table function is all about.
Using this approach, we can write PL/SQL that
a) dynamically determines the projection to return at run-time
b) dynamically creates/decides the rows to return as the result
This approach to dealing with a pivot is detailed in [url http://forums.oracle.com/forums/thread.jspa?messageID=1681340&#1681340]this posting
The SQL to pivot is simply specified and the pipeline table determines (at run-time) the required projection and result.
Not saying that this is the approach that you should use and will solve your problem. But if the problem includes having to deal not only with dynamic SQL, but dynamic projections too, this approach is one that I would consider.

Similar Messages

  • Is there a way to show busy cursor in indesign during long processing?

    Hi
    I have created an extension for inDesign. It has long processing. I want to show busy cursor while processing.
    Can anybody help me out?
    Best regards
    Sal

    @ stephen - Busy cursor is shown only on the extension and not anywhere in inDesign with "CursorManager.setBusyCursor();"
    @ Vamitul - its still showing normal cursor with setting ScriptPreference.enableRedraw to false

  • Cursor Variables in Pro*C/C++

    I have very strange behaivour of the client application that uses cursor variable.
    I have Oracle 8i enterprise 8.1.6 release for Sun/Solaris.
    The follow SQL is installed on server:
    create or replace package dummy is
    type vemap_cur is ref cursor;
    end;
    create or replace procedure GET_CUR
    ( N IN number, cur IN OUT dummy.VEMAP_CUR ) as
    begin
    open cur for
    select LS.ID, LS.SCALE
    from LAYERS LS
    where LS.ID = (select C.ID from CTM C where C.ORDERINDEX = N);
    end;
    This procedure (GET_CUR) i call from embedded SQL in follow manner:
    EXEC SQL BEGIN DECLARE SECTION;
    struct
    int n1;
    int n2;
    } resrec;
    sql_cursor c1;
    int num;
    EXEC SQL END DECLARE SECTION;
    EXEC SQL ALLOCATE :c1;
    EXEC SQL AT DB_VE EXECUTE
    BEGIN
    GET_VEC( :num, :c1 );
    END;
    END-EXEC;
    Till now it is Ok. But when i run the follow line
    EXEC SQL FETCH :c1 INTO :resrec;
    i accept ORA-01012: not logged on
    error !!!!
    I checked the connection via using cursor in paralell and got the correct answer.
    Therefore i think this error is not related to the actual problem and i have no idea what this problem is. I tried to open cursor via anonymous PL/SQL block inside my C program with same result.
    Need help ASAP.
    Leonid
    null

    Hi Leonid, Andrea
    When you use "CONNECT AT :db_handle" instead of default connection "CONNECT", you have to give the connect handle to the command you want to execute.
    ie:
    EXEC SQL AT :db_handle PREPARE SQL_stat FROM "select ...";
    EXEC SQL AT :db_handle DECLARE cur_stat CURSOR for SQL_stat;
    EXEC SQL AT :db_handle OPEN cur_stat ;
    EXEC SQL AT :db_handle FETCH cur_stat INTO :resrec;
    Leonid, the error you had is probably because you connected at "DB_VE", and tried to select from default connect (that you're not connected to ==> ORA-01012)
    Try EXEC SQL AT :DB_VE FETCH :c1 INTO :resrec;
    or, if you connect to only 1 database, use "EXEC SQL CONNECT;" instead of (EXEC SQL CONNECT :pConnectString AT "DB_VE";) so that you use default connect name and you don't have to add "AT :DB_VE" to your SQL commands.
    I know this reply comes long after your request, but I hope it may still help anybody.

  • How to (in Pro*C) pass a cursor variable as a pointer between functions

    I am opening a cursor in a called function that accepts as one argument a pointer to a cursor variable, and a second argument for the sql string defining the cursor select. That works fine, and in that same function can successfully fetch and access the records from the cursor. However, my objective is to fetch the records in another function that calls the first function. I want to pass back to the calling function the pointer to the cursor variable from the first function. In the second (calling) function, is where I want to fetch the records. What I am getting is SQLCODE = -1002 (fetch out of sequence).
    Here is the relevent code in the first called function that calls a PL/SQL package procedure to open the cursor, followed by the code in the second calling procedure where I am attempting to fetch the records:
    /******Called function code starts here ******/
    EXEC SQL INCLUDE SQLCA;
    long db_makeCursor(cursorID, SQLstr)
    EXEC SQL BEGIN DECLARE SECTION;
    sql_cursor cursorID;      / a pointer to a cursor variable */
    char *SQLstr;
    EXEC SQL END DECLARE SECTION;
    long SQLCODE;
    EXEC SQL BEGIN DECLARE SECTION;
    sql_cursor dbCursor; /* a cursor variable */
    EXEC SQL END DECLARE SECTION;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    dbCursor = *cursorID;
    EXEC SQL EXECUTE
    BEGIN
    db_util_ref_cursor_pkg.open_dbNameCursor( :dbCursor, :SQLstr );
    END;
    END-EXEC;
    return;
    /******Calling function code starts here ******/
    EXEC SQL INCLUDE SQLCA;
    EXEC SQL BEGIN DECLARE SECTION;
    static PROCLOG PROC_Rec;
    EXEC SQL END DECLARE SECTION;
    long retrieveProcesses( _proclog, sqlForProcLog )
    EXEC SQL BEGIN DECLARE SECTION;
    PROCLOG _proclog;
    char *sqlForProcLog
    EXEC SQL END DECLARE SECTION;
    long rc;
    long SQLCODE;
    EXEC SQL BEGIN DECLARE SECTION;
    sql_cursor dbCursor; /* a cursor variable */
    sql_cursor cursorID;      / a pointer to a cursor variable */
    PROCLOG proclog;
    short end_ts_ind;
    short proc_name_ind;
    short comments_ind;
    EXEC SQL END DECLARE SECTION;
    cursorID = &dbCursorName; /* assign a value to the pointer */
    EXEC SQL ALLOCATE :dbCursor;
    rc = dbUtilities_makeCursor( cursorID, sqlForProcLog);
    if (rc == TRUE)
    while (SQLCODE == 0)
    EXEC SQL FETCH :dbCursorName INTO
    :proclog.PROC_ID,
    :proclog.START_TS,
    :proclog.END_TS:end_ts_ind,
    :proclog.PROC_NAME:proc_name_ind,
    :proclog.COMMENTS:comments_ind,
    if (SQLCODE == 0)
    printf("PROC_ID: %d; COMMENTS: %s\n",proclog.PROC_ID, proclog.COMMENTS);
    } /* end retrieveProcesses */

    You need to include a loop...
    for i=0;i<sqlca.sqlerrd[2];i++)
    printf("name %s\n", struct.name)
    This allows you to step through your cursor records!!!

  • Running long processes

    I have a series of pages that perform the following
    functions:
    1. Query the database and present a list of selectable items
    with checkboxes next to each item. The user selects any number of
    items to report on.
    2. The selected items within the form are sent to a
    processing page that generate CFDOCUMENT pdf reports via a series
    of queries to the database for each item. The generated reports are
    saved to a temporary directory on the server and when the last
    report is created, they are zipped up and emailed to the user.
    All of this works quite well except that it can be a fairly
    long process especially if a fair number of items are selected. I
    can override the CF page timeout with the CFSETTING tag but there
    is an issue with the browser timing out. I had implemented a
    progress bar with a series of CFFLUSH commands to keep the browser
    receiving content, eliminating the browser timeout. However, the
    page now seems to ignore the flush commands and just displays it
    all at the end instead of incrementally. This seemed to happen when
    I changed the submitting form to one that posts the form data
    instead of calling the processing page with url variables. This was
    required when I went to a multiselect option. I'm not sure if this
    is the cause but I have tried everything I can to get the CFFLUSH
    flushing again to no avail.
    Is there a way to get the server to process the request in
    background mode? Since the user makes a request and doesn't receive
    any meaningful content on the screen after the request (they just
    expect the email to be sent), is there any way to make the server
    process the request even if the user disconnects or goes onto
    another page? This would be ideal. If not, does anyone have
    suggestions on getting CFFLUSH to work again. I have tried all the
    obrious things like checking for tags that are incompatible with
    the CFFLUSH tag and the IE need to have a certain amount of content
    sent to it before the CFFLUSH. Simple test pages seem to work.

    RE: bpdevlin
    I think you're on the right track. Capture and store whatever
    data you need (even credentials if necessary) in a new database
    table. As a side-note; if you are concerned about the credentials
    being in the database, you could consider using encryption.
    You could then create a new scheduled process with
    <cfschedule>, and have that process run pretty much
    immediately (by scheduling the task for a date in the past). That
    process would query the database for the data it needs, and then
    proceed with its "work". Once it's done "working", it could report
    a "done" status back to the database, or simply delete the record
    entirely.
    The front-end could periodically check for this "done" status
    (or for the absence of the record in the database), to know when it
    can send the user to the "view report/results" page. There are a
    lot of ways to accomplish this; one simple approach I've taken in
    the past is to embed a 1-pixel X 1-pixel <iframe> in the page
    that runs the "check if done" script over and over again. While
    this is happening, the main page/window could show an animated GIF
    that simply says "Please wait while we process your request...."
    (or something along those lines)
    There are a lot of different ways you could approach this,
    but I just thought I'd throw a few ideas out there to get your
    creative juices flowing :)
    Best of luck with it.

  • Creating variables in Process Flows and using thse variables in the filter

    Hi,
    I am new to OWB and in learing stage. Need to information.
    *1. as to how pass/create/use variables to OWB mapping ?*
    *2. Creating variables in Process Flows and using thse variables in the filter operator of the OWB mapping?*
    *3. Other mechanisms of how to create/use variables within OWB mapping itself ?*
    can you please provide the above details and guide me / help me in this regard.
    Thanks,
    skms.

    1. Add parameters to your mapping using the MAPPING INPUT PARAMETER from the pallette.
    2. Add parameters to the START operator in the process flow. Bind the process flow parameter to the Mapping parameter.
    3. May be appropriate to use CONSTANTS instead of parameters.
    Regards
    Si

  • BW Authorizations - Query variable with processing mode as "customer exit"

    Hi,
    Iam new to BW authorizations and have not yet worked on customer exit before. I was going through the documentation at various sites but I could not get the end to end description on how the query process( when using a variable for an InfoObject) works in case of customer exit.
    Let's assume that I am using  a query variable with processing mode as "customer exit" and at the exit I  write some code to extract user's authorizations from a z table. if this is the case, then when an end user runs a query,how will the the system know what value needs to be filled in the variable for the requesting user. Are the user details  also sent to the code along with the query variable? If so how. If I mis-understood the process then forgive me and let me know the correct process.

    Hi!
    welcome to SDN!
    customer exit variables need programing by user. so if you create a customer exit variable, you got to right a program which extracts values into this variable. we can do what ever we want in program, SAP will not deal anything ´with customer exits.
    with regards
    ashwin
    PS n:  Assigning point to the helpful answers is the way of saying thanks in SDN.  you can assign points by clicking on the appropriate radio button displayed next to the answers for your question. yellow for 2, green for 6 points(2)and blue for 10 points and to close the question and marked as problem solved. closing the threads which has a solution will help the members to deal with open issues with out wasting time on problems which has a solution and also to the people who encounter the same porblem in future. This is just to give you information as you are a new user.

  • How to pass a litral string into cursor variable?

    Hi All
    I have a code like below:
    I need to select the following table,column with the criteria as such but it looks like the literal string does not work for cursor variable.
    I can run the SQL in sqlplus but how I can embed that in PL/SQL code??
    -Thanks so much for the help
    cursor ccol2(Y1 varchar2) is select table_name,column_name from user_tab_columns
    where table_name like 'HPP2TT%' and table_name like '%Y1'
    and column_name not in ('MEMBERID');

    Literal strings are fine in a cursor, however, your logic is likely wrong, and you are not using the Y1 parameter to the cursor correctly. If you are looking for tables that either start with HPP2TT or end with Y1 (whatever you pass as Y1), then you need something more like:
    cursor ccol2(Y1 varchar2) is
    select table_name, column_name
    from user_tab_columns
    where (table_name like 'HPP2TT%' or
           table_name like '%'||Y1) and
          column_name not in ('MEMBERID');In the unlikely event that you are lookig for table that actually do start with HPP2TT and end in whatever is passed in Y1 then your query could be simplified to:
    cursor ccol2(Y1 varchar2) is
    select table_name, column_name
    from user_tab_columns
    where table_name like 'HPP2TT%'||Y1 and
          column_name not in ('MEMBERID');Note in both cases, a single member in-list is bad practice, although Oracle will transform it to an equality predicate instead.
    John

  • How to inspect a cursor variable in a debug session?

    In a function inside the body of a package I do...
    Example:
    V_SITUACIONESACTYHIST C_SITUACIONESACTYHIST%ROWTYPE;
    BEGIN
    FOR v_SituacionesACTyHIST IN c_SituacionesACTyHIST( p_id_DECE400, p_idpers )
    LOOP
    IF ( V_SITUACIONESACTYHIST.ESTADO_SITUACION = 'S' ) THEN
    v_hay_regs_hist:=1;
    END IF;
    END LOOP;
    where the cursor variable c_SituacionesACTyHIST is declared in the specifications package (Is this the problem, because is a global declaration?).
    When debugging I cannot inspect the value of V_SITUACIONESACTYHIST.ESTADO_SITUACION or whatever cursor variable field; I always obtain "NULL" as value...
    Why?
    How can I see the value of that variables?
    I have the same problem in v2.1 and 1.5.5 version of sqldeveloper.
    Thanks.
    Edited by: pacoKAS on 11-feb-2010 0:14
    Edited by: pacoKAS on 11-feb-2010 0:17
    Edited by: pacoKAS on 11-feb-2010 0:17
    Edited by: pacoKAS on 11-feb-2010 0:19
    Edited by: pacoKAS on 11-feb-2010 0:21
    Edited by: pacoKAS on 11-feb-2010 0:22
    Edited by: pacoKAS on 11-feb-2010 0:22

    I'm proposing that you don't have a variable named the same as your cursor variable.
    CREATE OR REPLACE
    PROCEDURE P1
    AS
      CURSOR test_cur
      IS
        SELECT owner, table_name FROM all_tables WHERE ROWNUM <= 10;
      --  x test_cur%rowtype;  /* This variable is not needed. */
    BEGIN
      FOR x IN test_cur  /* If you don't have another variable named x somewhere, you can see values for x */
      LOOP
        dbms_output.put_line(x.owner || '.' || x.table_name);
      END LOOP;
    END P1;from your example...
    V_SITUACIONESACTYHIST C_SITUACIONESACTYHIST%ROWTYPE;
    BEGIN
    FOR v_SituacionesACTyHIST IN c_SituacionesACTyHIST( p_id_DECE400, p_idpers )
    LOOP
    IF ( V_SITUACIONESACTYHIST.ESTADO_SITUACION = 'S' ) THEN
    v_hay_regs_hist:=1;
    END IF;
    END LOOP;You're declaring your variable twice:
    (1) V_SITUACIONESACTYHIST C_SITUACIONESACTYHIST%ROWTYPE;
    (2) FOR v_SituacionesACTyHIST IN c_SituacionesACTyHIST
    When you're debugging, it's looking at the first version...which is null because you haven't assigned anything to it. When you use a Cursor For-Loop like that, it implicitly declares the variable for you. You don't have to do it in your DECLARE section.
    Edited by: DylanB123 on Feb 16, 2010 1:04 PM

  • Cursor variable in a Java program

    Hi all,
    I would like to know is how to explicitly pass a cursor variable to a stored procedure after defining it in the java source and to get the result back to the same variable.
    An example would be appreciated.
    Thanks in advance
    Giridhar

    I think java profiler can do the job. There are sharewares i know of like JSprint and JProfiler.

  • Getting error in cursor variable in CallableStatement

    Hi,
    I am trying to retrieve result set from PL/SQL procedure using cursor variable.
    but I getting error sometime.
    this is code in my program...
    CallableStatement pstmt=null;
    pstmt = con.prepareCall("{call Crms2.SearchRNameTime(?,?,?,?,?,?)}");
    pstmt.setString(1, uid);
    pstmt.setString(2, strBookingDate);
    pstmt.setInt(3, roomid);
    pstmt.setInt(4, lngStartTime);
    pstmt.setInt(5, lngEndTime);
    pstmt.registerOutParameter(6, oracle.jdbc.driver.OracleTypes.CURSOR ); // error accured in this line
    pstmt.execute();
    rs = (ResultSet)pstmt.getObject(6);
    error was accrued at line : pstmt.registerOutParameter(6, oracle.jdbc.driver.OracleTypes.CURSOR );
    error is: orable.jdbc.driver can not resolve tha symbol..
    but it some time executing , some time giving error.
    it is require any package to import?
    please help me on this problem.
    regards
    Narru

    990187 wrote:
    i have created a cursor to return only 5th row from a table .
    declare
    cursor cur is select * From(select last_name,salary,rownum rn from employees where rownum<=50)) where rn=5;
    just a side note, (others have helped with the actual error already), using "rownum" like you do isn't very consistent. Not really sure about the requirment of "5th row", but no matter. Just keep in mind that the way Oracle assigns a rownum, and the fact you have no sorting/order ... you are - effectively - getting a random row. That is, with no data changing, Oracle may very well retrieve things in a different order due to index, new oracle version, whatever.
    If you do actually need the 5th row where you have some sorting (ie 5th largest salary, or 5th record by last name, etc. ), then you may want to consider something like:
    select * from (select last_name, salary, row_number() over (order by salary desc) rn from employees) where rn = 5;
    or whatever your sort criteria is. Do a search for "Top N" queries if you need more info.
    It'll work a bit more consistently.

  • My cursor has long vertical line at times

    My cursor has long vertical lines at times. When I hover over a link, the cursor doesnt' change to a hand

    I don't know if this applies to LCDs, but the iMac G3 and eMac had "geometry settings" in the display preferences. If you messed up the settings, things like lines on the bottom and skewed images could happen.
    I wonder if the factory geometry settings are off on your iMac? There is no way to set these with System Prefs.
    I found someone asking about it here: https://discussions.apple.com/thread/3019584?start=0&tstart=0

  • Very hard to implement a long process dll or applicatio​n in TestStand such as firmware download task.

    Hi All
    In my daily projects there are many firmware download tasks on mass production for kinds of products sucha s phone, mp3, game box and so on. The common download is performed via USB or serial port.
    Firmware download is often a long process what will take up to hundreds of seconds. The download application or dll is often provided by customer or the chipset supplier, I have ever call a download dll in TestStand, the only way is to run the dll in another threading and at the UI threading I monitor the dll's log file for status, it looks a very stupid way to do, things oftn lose control.
    This time I have to automatically download firmwares to a mp3(Sigmatel chipset), Sigmatel provided an application for parallel downloading what is very unstable, the application often hangs or crash, I tried to update the application source code but Sigmatel says they will not support if I change something.
    If someone use the application, he needs to press the START button, if fail, press the STOP firstly, if crash..... everything lose control. In my opinion, even if I change the application to a dll, there are still long processes, I must let TestStand wait there for the log file information? I do not think that is a good idea.
    My thought is this is a usual task in manufacturing, could someone please advice me how do you handle this kind of testing in your test station? How to run a long process task in TestStand and communicatio with it and keep everything in control.
    Thanks.
    帖子被paulbin在04-06-2008 07:49 PM时编辑过了
    *The best Chinese farmer*

    Hi,
    I have used a VC++ dll
    Here are some snipptes
    void CProcessLoaderApp:ostMessageToProcess(LPPROCESS_INFORMATION lpProcessInformation,UINT Msg, WPARAM wParam, LPARAM lParam)
     FINDWINDOWHANDLESTRUCT fwhs;
     fwhs.ProcessInfo = lpProcessInformation;
     fwhs.hWndFound  = NULL;
    EnumWindows ( EnumWindowCallBack, (LPARAM)&fwhs ) ;
     PostMessage ( fwhs.hWndFound, Msg, wParam, lParam );
    BOOL CALLBACK CProcessLoaderApp::EnumWindowRcs5SystemTestCallBac​k(HWND hwnd, LPARAM lParam)
     FINDWINDOWHANDLESTRUCT * pfwhs = (FINDWINDOWHANDLESTRUCT * )lParam;
     DWORD ProcessId;
     CString Title;
     GetWindowThreadProcessId ( hwnd, &ProcessId );
     // note: In order to make sure we have the MainFrame, verify that the title
     // has Zero-Length. Under Windows 98, sometimes the Client Window ( which doesn't
     // have a title ) is enumerated before the MainFrame
     CWnd::FromHandle( hwnd )->GetWindowText(Title);
     if ( ProcessId  == pfwhs->ProcessInfo->dwProcessId && Title.Compare("MyApplicationName_ReplaceThatStuff"​) == 0)
      pfwhs->hWndFound = hwnd;
      return false;
     else
      // Keep enumerating
      return true;
     MainStuff:
    SetCursorPos(10,23);
     m_App.PostMessageToProcess(&g_pi,WM_LBUTTONDOWN,0​x01,0x000A0017);
      WaitForSingleObject(Event,200);
     m_App.PostMessageToProcess(&g_pi,WM_LBUTTONUP,0x0​0,0x000A0017);
      WaitForSingleObject(Event,200);
    Greetings
    juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

  • Obtaining a weakly typed cursor variable's field list

    In a situation where a weakly typed cursor variable is passed to a procedure, after having been previously opened, is there any way to find out what the field names or aliases are that make up the underlying cursor? Is this information available in some dynamic view?

    Try:
    select view_name from dba_views where view_name like '%CURSOR%';
    The views you may be interested in are gv_$open_cursor and v_$open_cursor. Both have a column named SQL_TEXT that will at least give the statement the cursor is executing.
    Hope this helps.

  • Fetch from cursor variable

    Hello,
    I have a procedure, which specification is something like that:
    procedure proc1 (pcursor OUT SYS_REFCURSOR, parg1 IN NUMBER, parg2 IN NUMBER, ...);Inside the body of proc1 I have
    OPEN pcursor FOR
      SELECT column1,
                  column2,
                  CURSOR (SELECT column1, column2
                                    FROM table2
                                  WHERE <some clauses come here>) icursor1
          FROM table1
       WHERE <some clauses come here>;In a PL/SQL block I would like to execute proc1 and then to fetch from pcursor. This is what I am doing so far:
    DECLARE
      ldata SYS_REFCURSOR;
      larg1 NUMBER := 123;
      larg2 NUMBER := 456;
      outcolumn1 dbms_sql.Number_Table;
      outcolumn2 dbms_sql.Number_Table;
    BEGIN
      some_package_name.proc1 (ldata, larg1, larg2, ...);
      FETCH ldata BULK COLLECT INTO
        outcolumn1, outcolumn2,...,  *and here is my problem*;
    END;
    /How can I rewrite this in order to get the content of icursor1 ?
    Thanks a lot!

    Verdi wrote:
    How can I rewrite this in order to get the content of icursor1 ?
    Firstly ref cursors contain no data they are not result sets but pointers to compiled SQL statements.
    Re: OPEN cursor for large query
    PL/SQL 101 : Understanding Ref Cursors
    Ref cursors are not supposed to be used within PL/SQL or SQL for that matter, though people keep on insisting on doing this for some reason.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/static.htm#CIHCJBJJ
    Purpose of Cursor Variables
    You use cursor variables to pass query result sets between PL/SQL stored subprograms and their clients. This is possible because PL/SQL and its clients share a pointer to the work area where the result set is stored.A ref cursor is supposed to be passed back to a procedural client language, such as Java or .Net.
    If you want to re-use a SQL statement in multiple other PL/SQL or SQL statements you would use a view.

Maybe you are looking for