Dispalying output from a REF CURSOR

Friends,
I'm getting my self into indepth pl/sql and need some help from you to clear some basic concepts.
create table MASTER_TABLE
street_info varchar2(100),
property_type varchar2(50) ------- i.e values here would be 'HOME_TABLE' ,'COM_PROP_TABLE' etc
create table HOME_TABLE
property_id char(5),
prop_desc varchar2(100),
cost varchar2(10),
location varchar2(100)
create table COM_PROP_TABLE
property_id char(5),
prop_desc varchar2(100),
cost varchar2(10),
location varchar2(100)
I want to use a single procedure to open a weak REF CURSOR variable for the appropriate table based on the street address and display all information from that table.
Here is what I want to to - execute a stored procedure which accepts 1 'in' paramter and 1 'in out ' parameter.
IN paramter - accepts street address
IN OUT paramter - depending on address , if it is related to 'Homes' , it should display all information from the HOME Table, else it will display information from the 'Commerical Property' table.
create or replace package pack_address_info as
type v_info_type ref cursor;
end pack_address_info;
create or replace procedure schema.sp_home_info(v_add in varchar2,v_show in out v_info_type)
is
home_type constant integer :=1;
commercial_type constant integer :=2;
cursor show_data_cur is
select property_type from MASTER TABLE where street_info=v_add;
var_cursor show_data_cur%rowtype;
begin
open show_data_cur;
fetch show_data_cur into var_cursor;
close show_data_cur;
if var_cursor.property_type= HOME_TABLE
then
open v_show for
select * from HOME_TABLE where location=v_add;
elseif var_cursor.table_name = COM_PROP_TABLE
then
open v_show for
select * from COM_PROP_TABLE where location=v_add;
end if;
end schema.sp_home_info;
I can create the package and the stored proc ... but then ???? i'm stuck ;(
Now , i don't know how to display the output from the HOME TABLE or the COM_PROP_TABLE depending on what the address is entered? Is this code correct. Can you please help me modify this code so that I can achieve my objective.
This is an example from the book 'Oracle PL/SQL Programming, 4th Edition' under the 'CURSOR' section - 15.6
Thanks for the help in advance.

Here is one sample ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.02
satyaki>
satyaki>
satyaki>CREATE OR REPLACE PACKAGE aaa_sat     
  2  AS       
  3     TYPE crs IS REF CURSOR RETURN emp%ROWTYPE;        
  4     FUNCTION fc_retcur (e_no IN NUMBER)
  5     RETURN crs;
  6  END aaa_sat;
  7  /
Package created.
Elapsed: 00:00:01.03
satyaki>
satyaki>
satyaki>CREATE OR REPLACE PACKAGE BODY aaa_sat     
  2  AS       
  3    FUNCTION fc_retcur (e_no IN NUMBER)
  4    RETURN crs       
  5    IS         
  6      l_crs   crs;       
  7    BEGIN         
  8      OPEN l_crs FOR
  9      SELECT * FROM emp           
10      WHERE empno = e_no;          
11     
12      RETURN l_crs;       
13    END;
14  END aaa_sat;
15  /
Package body created.
Elapsed: 00:00:00.18
satyaki>
satyaki>
satyaki>DECLARE       
  2    l_emp_rec   emp%ROWTYPE;       
  3    l_crs       aaa_sat.crs;     
  4  BEGIN       
  5    l_crs := aaa_sat.fc_retcur (7782);        
  6    LOOP          
  7      FETCH l_crs           
  8      INTO l_emp_rec;           
  9        EXIT WHEN l_crs%NOTFOUND;          
10          DBMS_OUTPUT.put_line (l_emp_rec.ename);     
11    END LOOP;        
12    CLOSE l_crs;    
13  END;
14  /
CLARK
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.40
satyaki>
satyaki>Got Me?
Regards.
Satyaki De.

Similar Messages

  • How to get values from a ref cursor in a procedure

    I have a procedure that returns a cursor type of values, but I cannot get the values.
    I got error when on how to define the output cursor. Could someone please look at the code and tell me how to correct it?
    Thanks in advance.
    ******************************8
    --This is the package
    CREATE OR REPLACE PACKAGE Test_SECURITY2 as
    type T_RoleTest is ref cursor;
    Procedure P_GetUserRole(userID in number, p_cur out T_RoleTest);
    end;
    CREATE OR REPLACE PACKAGE BODY Test_SECURITY2 as
    Procedure P_GetUserRole(userID in number, p_cur out T_RoleTest) as
    begin
         open p_cur for
         select PREO_Role.ROLE_ID,PREO_Role.ROLE_NAME
         from preorder.PREO_Role, preorder.PREO_User_Role
         where PREO_Role.Role_id = PREO_User_Role.Role_id
         and PREO_User_Role.user_id = userid;
    end;
    end;
    --This is the testing code. I got error here
    SQL> set serveroutput on;
    SQL> execute dbms_output.enable;
    PL/SQL procedure successfully completed.
    SQL> declare
    2 type T_RoleTest is ref cursor;
    3 V_UserRole is ref cursor; --how to define the output cursor
    4 v_userId number := 42;
    5 V_Role_Id number;
    6 v_Role_name varchar2(20);
    7 begin
    8 Test_SECURITY2.P_GetUserRole(v_userId, V_UserRole);
    9
    10 open V_UserRole;
    11 loop
    12 fetch V_UserRole into V_Role_Id, v_Role_name;
    13
    14 EXIT WHEN V_UserRole%NOTFOUND;
    15 dbms_output.put_line('RoleID'||v_Role_ID);
    16 dbms_output.put_line('Rolename'||v_Role_name);
    17
    18 end loop;
    19
    20 end;
    21 /
    V_UserRole is ref cursor;
    ERROR at line 3:
    ORA-06550: line 3, column 13:
    PLS-00103: Encountered the symbol "IS" when expecting one of the following:
    constant exception <an identifier>

    declare
      type T_RoleTest is ref cursor;
      v_UserRole T_RoleTest;or just:
    declare
      v_UserRole  Test_Security2.T_RoleTest;And, if you are on 9i or later, you can just use the built-in sys_refcursor type.

  • How to retrieve data from a REF CURSOR using OCI 8.0?

    I found an example in Oracle docs (shown below) that discusses how to bind a REF CURSOR for later data retrieval, but it does not explain actually how to do the later data retrieval.
    I hope someone can explain it to me. Thanks
    The OCI provides the ability to bind and define PL/SQL REF CURSORs and nested tables. An application can use a statement handle to bind and define these types of variables. As an example, consider this PL/SQL block:
    static const text plsql_block = (text )
    "begin \
    OPEN :cursor1 FOR SELECT empno, ename, job, mgr, sal, deptno \
    FROM emp_rc WHERE job=:job ORDER BY empno; \
    OPEN :cursor2 FOR SELECT * FROM dept_rc ORDER BY deptno; \
    end;";
    An application would allocate a statement handle for binding, by calling OCIHandleAlloc(), and then bind the :cursor1 placeholder to the statement handle, as in the following code, where :cursor1 is bound to stm2p. Note that the handle allocation code is not included here.
    err = OCIStmtPrepare (stm1p, errhp, (text *) nst_tab, strlen(nst_tab),
    OCI_NTV_SYNTAX, OCI_DEFAULT);
    err = OCIBindByName (stm1p, (OCIBind **) bndp, errhp,
    (text *)":cursor1", (sb4)strlen((char *)":cursor1"),
    (dvoid *)&stm2p, (sb4) 0, SQLT_RSET, (dvoid *)0,
    (ub2 *)0, (ub2 *)0, (ub4)0, (ub4 *)0, (ub4)OCI_DEFAULT);
    In this code, stm1p is the statement handle for the PL/SQL block, while stm2p is the statement handle which is bound as a REF CURSOR for later data retrieval. A value of SQLT_RSET is passed for the dty parameter.

    ( sorry, i forgot the Link where i get this html fiLes, so i just copy-paste here )
    ( maybe it can heLp you a bit. -- it's heLp me, for sure )
    And the following is thanks to Brett Rosen :
    I noticed that you didn't have an OCI entry
    on http://osi.oracle.com/~tkyte/ResultSets/index.html .
    Here is OCI code to do this (Oracle 81) if you want to include it on
    that page.
    Some error checking and cleanup has been removed, but the below should
    work. (once dbname has been replaced appropriately)
    Brett
    int main(int argc, char* argv[])
    OCIError* pOciError;
    char* pConnectChar = "dbname";
    char* pUsernameChar = "scott";
    char* pPasswordChar = "tiger";
    int answer;
    OCIStmt* pOciStatement;
    char* sqlCharArray = "BEGIN :success := sp_ListEmp; END;";
    int id;
    char ename[40];
    OCIEnv* g_pOciEnvironment = NULL;
    OCIServer* g_pOciServer = NULL;
    OCISession* g_pOciSession = NULL;
    OCISvcCtx* g_pOciServiceContext = NULL;
    sb2* pIndicator=0;
    sb2* pIndicator2=0;
    sb2* pIndicator3=0;
    OCIDefine* pOciDefine;
    OCIDefine* pOciDefine2;
    OCIBind* pBind;
    OCIStmt* cursor;
    answer = OCIInitialize(OCI_THREADED, NULL, NULL, NULL, NULL);
    answer = OCIEnvInit(&g_pOciEnvironment, OCI_DEFAULT, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciSession, OCI_HTYPE_SESSION, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciServer, OCI_HTYPE_SERVER, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
    answer = OCIServerAttach(g_pOciServer, pOciError, (unsigned char *)pConnectChar, strlen(pConnectChar),
    OCI_DEFAULT);
    answer = OCIAttrSet(g_pOciSession, OCI_HTYPE_SESSION, (unsigned char *)pUsernameChar, strlen(pUsernameChar),
    OCI_ATTR_USERNAME, pOciError);
    answer = OCIAttrSet(g_pOciSession, OCI_HTYPE_SESSION, (unsigned char *)pPasswordChar, strlen(pPasswordChar),
    OCI_ATTR_PASSWORD, pOciError);
    answer = OCIAttrSet(g_pOciServiceContext, OCI_HTYPE_SVCCTX, g_pOciServer, 0, OCI_ATTR_SERVER, pOciError);
    answer = OCIAttrSet(g_pOciServiceContext, OCI_HTYPE_SVCCTX, g_pOciSession, 0, OCI_ATTR_SESSION, pOciError);
    answer = OCISessionBegin(g_pOciServiceContext, pOciError, g_pOciSession, OCI_CRED_RDBMS, OCI_DEFAULT);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)(&pOciStatement), OCI_HTYPE_STMT, 0, NULL);
    answer = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray, strlen(sqlCharArray),
    OCI_NTV_SYNTAX, OCI_DEFAULT);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)(&cursor), OCI_HTYPE_STMT, 0, NULL);
    answer = OCIBindByPos(pOciStatement,&pBind, pOciError, 1, &cursor, 0,SQLT_RSET,
    pIndicator2, 0,NULL, 0,0,OCI_DEFAULT);
    answer = OCIStmtExecute(g_pOciServiceContext, pOciStatement, pOciError, 1, 0, NULL, NULL,
    OCI_COMMIT_ON_SUCCESS);
    answer = OCIDefineByPos(cursor,&pOciDefine, pOciError,2,&id,sizeof(int),
    SQLT_INT,pIndicator, 0, 0,OCI_DEFAULT);
    answer = OCIDefineByPos(cursor,&pOciDefine2, pOciError,1,ename,40,
    SQLT_STR,pIndicator3, 0, 0,OCI_DEFAULT);
    if (answer == 0)
    while ((answer = OCIStmtFetch(cursor,pOciError, 1,OCI_FETCH_NEXT,OCI_DEFAULT)) == 0)
    printf("fetched id %d and name %s\n",id,ename);
    answer = OCIHandleFree(pOciError, OCI_HTYPE_ERROR);
    return 0;
    }

  • How to fetch less number of columns from a ref cursor

    I have a ref cursor which has 10 columns. After "OPEN"ing the ref cursor I want to "FETCH" only 3 columns. When I try that I am getting error. How to achieve that?
    Regards.
    Shantanu.

    Supposing your first 3 columns are "stable" in name and type for any SQL statement you use, you can do something like:
    SQL> create or replace procedure stable (sql_s in varchar2)
      2  is
      3   empno emp.empno%type;
      4   ename emp.ename%type;
      5   a sys_refcursor;
      6  begin
      7   open a for 'select empno, ename from (' || sql_s ||')';
      8   fetch a into empno, ename;
      9   while(a%found) loop
    10    dbms_output.put_line(ename || '/' || empno);
    11    fetch a into empno, ename;
    12   end loop;
    13   close a;
    14  end;
    15  /
    &nbsp
    Procedure created.
    &nbsp
    SQL> set serveroutput on;
    SQL> exec stable('select * from emp');
    SMITH/7369
    ALLEN/7499
    WARD/7521
    JONES/7566
    MARTIN/7654
    BLAKE/7698
    CLARK/7782
    SCOTT/7788
    KING/7839
    TURNER/7844
    ADAMS/7876
    JAMES/7900
    FORD/7902
    MILLER/7934
    &nbsp
    PL/SQL procedure successfully completed.
    &nbsp
    SQL> exec stable('select empno, ename, sal from emp');
    SMITH/7369
    ALLEN/7499
    WARD/7521
    JONES/7566
    MARTIN/7654
    BLAKE/7698
    CLARK/7782
    SCOTT/7788
    KING/7839
    TURNER/7844
    ADAMS/7876
    JAMES/7900
    FORD/7902
    MILLER/7934
    &nbsp
    PL/SQL procedure successfully completed.Rgds.

  • Manipulating data from a ref cursor in the data block of a form

    I am using Oracle Forms 10g. I have a ref cursor which returns columns A, B, C, D, E where B, C, D, E are values. The "Query Data Source Name" attribute in the datablock contains "CCTR_Extract_pkg.cctr_refcur". The "Column Name" attribute of item A contains "A", item B contains "B", etc. All of these columns are displayed on the form and it all works perfectly.
    I have a new request, the users would like a 6th column displayed - column F - where it equals D - B.
    Is there any way of doing this in the form only or do I need to change the ref cursor to accomodate the new column and then the form?
    If it can be achieved in the Form (only) - then how do I reference the 2 columns?
    Thanks in anticipation
    Michael
    Edited by: user8897365 on 24-Aug-2011 10:32

    Is there any way of doing this in the form only or do I need to change the ref cursor to accomodate the new column and then the form? The REF_CURSOR is the data source of your block so you will have to modify the CCTR_Extract_pkg package and cctr_refcur REF_CURSOR.
    If it can be achieved in the Form (only) - then how do I reference the 2 columns?After you have modified your database package, I recommend you run the Data Block Wizard on your block and let Forms detect the 2 new columns. You can do this manually, but it is safer to let Forms do it for you. If you want to do it manually, open the Query Data Source Columns property and add your new columns.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Can the return from xsql:ref-cursor-function be saved & looped through XSQL?

    If <xsql:ref-cursor-function> returns one field for a number of rows, is there a way to save those values and loop through the data retrieved for other query process within XSQL? Any example?
    Thanks.
    null

    You have a couple of options.
    You can process the XML returned by <Xsql:ref-cursor-function> as the normal part of XSLT processing, or you can write a custom action handler that aggregates the action handler for <xsql:ref-cursor-function> and then uses DOM to operate on the return value.
    Search the Online XSQL Pages Documentation for the term "MyIncludeXSQLHandler" for some sample code that illustrates building a customer action handler that aggregates one of the built-in handlers.

  • How to create table from ref cursor

    I have a proc that returns a ref cursor, whats the simplest way to create a table based on the return of the ref cursor?
    declare
    type rc is ref cursor;
    p_data rc;
    begin
    call_my_proc(p_data);
    :result := p_data; -- If I run this in TOAD I can see the data here but I want to create a table based on it rather than outputting it)
    end;
    thanks.
    edit: sorry. typed this wrong first time, should be right now

    961469 wrote:
    I have a proc that returns a ref cursor, whats the simplest way to create a table based on the return of the ref cursor?Not to do it...
    A cursor is not a result set. A cursor is not a result set. Worth repeating several times as this is a common misconception
    A cursor is essentially a program. Executable code that was compiled from a SQL source code program.
    A SELECT cursor is "read" program. Each fetch instruction runs this program (from its current "paused state"), and outputs data.
    An INSERT cursor is a "write" program. You pass data to it (process called binding, via bind variables). You then execute the program. It writes the data it received (can be bulk data via a bulk bind) to table.
    Now your question is: How do I write the output of a cursor program back to the database?
    The answer is that a "write" cursor program is needed. Your code needs to execute (fetch output from) the ref (read/select) cursor. Then bind that data to the "write" cursor and execute it.
    In other words, you have a read cursor and a write cursor, and you need to pass data from one to the other.
    HOWEVER.. This is slow. This does not scale. This is also known as slow-by-slow row by row processing.
    The correct approach is to create a single program. One that reads the data, and then writes the data. No to send data via a detour through your code between the read part and write part.
    The cursor to create is an INSERT..SELECT cursor. This can do fast direct path inserts. This can be executed in parallel - i.e. the database executing several copies of this read-and-write program at the same time.

  • Help needed in Ref cursor

    Hi,
    I am new to Ref Cursor concepts and I am trying a small block but its throwing error. Pls help me.
    PACKAGE SPEC:
    CREATE OR REPLACE PACKAGE PKG_JOBINFO AS
    PROCEDURE JOBINFO ( v_job_id IN number, p_cursor OUT PKG_JOBINFO.RESULT_REF_CURSOR);
    TYPE RESULT_REF_CURSOR IS REF CURSOR;
    END PKG_JOBINFO;
    PACKAGE BODY:
    CREATE OR REPLACE package body PKG_JOBINFO
    AS
    PROCEDURE JOBINFO ( v_job_id IN number,
    p_cursor OUT PKG_JOBINFO.RESULT_REF_CURSOR)
    AS
    BEGIN
    OPEN p_cursor FOR
    SELECT JOB_ID,
    JOB_NAME,
    TABLE_NAME
    FROM JOB_INFO
    WHERE JOB_ID=V_JOB_ID;
    EXCEPTION
    WHEN OTHERS THEN
    raise;
    END;
    END;
    While compiling the package i am not getting any errors. I am getting errors only while executing
    SQL> exec PKG_JOBINFO.JOBINFO ('23');
    BEGIN PKG_JOBINFO.JOBINFO ('23'); END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'JOBINFO'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Please help me to resolve this error.
    Thanks.

    user497267 wrote:
    Thanks its working. So if we are using ref cursor we have to execute like this only.To add...
    The actual issue you were experiencing was not because you were using ref cursors specifically, but because you had an OUT parameter in your procedure.
    When you have an OUT parameter, you need to ensure that you pass in a variable to that parameter of the procedure in order that the procedure can populate it. In your case you were only passing in the first parameter, but you weren't passing in a variable to capture the OUTput.
    What Alex showed was that by declaring a variable of the same datatype (ref cursor in your case) and passing that in as the second parameter, that variable was populated with the ref cursor information from inside the procedure. Once that variable was populated, after the procedure call, the data from that ref cursor can be obtained (using SQL*Plus' print command in Alex's example).

  • How to divide resultset of a query in different ref cursors in a package

    Hi Oracle Gurus,
    I need to create a package which counts the no of rows returned by a select query on multiple tables and according to the returned rowcount inputs the resultset in a ref cursor. Procedure will be called by a .NET program and output param refcursor will be assigned to a data reader which will redirect all the data to an Excel file.
    All the above is done. Issue is due to Excel's limit of 64000 rows, if data returned by query is greater than 64K it wont be fit in 1 Excel sheet. So, in order to overcome this limit I need to do some looping in Oracle package which keeps on storing the query results (rows<64K) in different ref cursors so that these refcursors as OUT params can be redirected to separate Excel sheets in C# program.
    NOTE : Earlier on I created 2 procedures in the package to fetch rows<64K and another one to fetch rows between 64K and rowcount of the query. My program was calling 2 different procedures to redirect data into 2 diff Excel sheets.
    But this fails when query resultset is even greater than 128000 or more and demands 3-4 or even more Excel sheets to be created.
    Please help.
    Any idea how to do looping in Oracle to accomplish this?

    > So, in order to overcome this limit I need to do some looping in Oracle package which keeps on
    storing the query results (rows<64K) in different ref cursors so that these refcursors as OUT params
    can be redirected to separate Excel sheets in C# program.
    Huh?
    That is saying that "I need to change this road and build it straight through that lake as the road has a curve here".
    It surely is a LOT easier to leave the road as is and simply turn the darn steering wheel in the car?
    Have the .Net data reader keep a row count of rows read from the ref cursor - and when it reached a pre-set max, have the reader do a "control break"[1] and change to a new worksheet as the destination for writing the rows to.
    [1] Google the term if you do not understand this basic concept that was among the very basic program control structures taught back in the 80's.. while I foam at the mouth how today's "wonder kids" turned programmers, that grew up with computers, do not even comprehend the most basic programming logic designs...

  • [Resolved]VO on Ref Cursor - attempt to save = RowNotFoundException

    I have a view object created from a ref cursor following 27.8.4 in the Oracle Application Development Framework Developer's Guide for Forms/4GL Developers. Using JDev 10.1.2 (yes, old version, but is consistent with all applications on current app server.) following the example at http://www.oracle.com/technology/obe/obe9051jdev/ADFWorkshop/BuildingADFApplicationsWorkshop.htm
    I have a simple table with edit and delete columns on each row. The delete calls an onDelete() method in the browse...Action.java which calls a delete PL/SQL routine. Works great!
    Now the edit calls a form for editing, just like in the OBE.
    In the edit form, I change the displayname input field.
    Press submit, get RowNotFoundException
    press submit again, no errror
    press save - goes back to the table and everything looks great.
    So, what is causing the error, and how can I get this to work on the first press of the save button?
    EditNewslineArchiveAction.onSave()
    public void onSave(DataActionContext ctx) {
    System.out.println("*** EditApplicantAction.onSave() ***");
    DCBindingContainer bindings = ctx.getBindingContainer();
    DCControlBinding binding;
    // For fun, get the current row, and display the key
    try {
    // Get a reference to the currentRow()
    DCIteratorBinding dcIter = bindings.findIteratorBinding("SearchRefCursor1Iterator");
    Row r = dcIter.getCurrentRow();
    System.out.println("Current Row.key = " + r.getKey().toStringFormat(true));
    } catch (Exception e) {
    System.out.println(e.getMessage() );
    e.printStackTrace(System.out);
    // get values from form
    binding = bindings.findCtrlBinding("Masterid");
    String masterId;
    masterId = (binding != null) ? binding.toString() : "";
    System.out.println("masterId = " + masterId);
    binding = bindings.findCtrlBinding("DisplayName");
    String displayName;
    displayName = (binding != null) ? binding.toString() : "";
    System.out.println("displayName = " + displayName);
    if (!(masterId == null)) {
    BindingContext bc = ctx.getBindingContext();
    DCDataControl dc = bc.findDataControl("NewslineArchiveServiceDataControl");
    NewslineArchiveService service = (NewslineArchiveService)dc.getDataProvider();
    service.updateNewslineArchiveItem(masterId,displayName);
    ctx.setActionForward(ctx.getActionMapping().findForward("Save"));
    * if (ctx.getEventActionBinding() != null) {
    * ctx.getEventActionBinding().doIt();
    The onSubmit method just gets a reference to the current row and displays the value in a try catch block.
    There is a onCancel method that sets an action forward, and goes back to the table page view.
    Here is the output from the OC4J window. The "row.key =" is located in the createRowFromResultSet method. The "Current Row.key =" is in both the EditNewslineArchiveAction.onSave() and EditNewslineArchiveAction.onSubmit() methods.
    [Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
    C:\jdev1012\jdev\system10.1.2.2.0.1929\oc4j-config>
    C:\j2sdk1.4.2_09\bin\javaw.exe -client -classpath C:\jdev1012\j2ee\home\oc4j.jar;C:\jdev1012\jdev\lib\jdev-oc4j.jar -Xverify:none -Ddisable.checkForUpdate=true -Doracle.j2ee.dont.use.memory.archive=true -Doracle.j2ee.http.socket.timeout=500 -Doracle.dms.sensors=NONE -Doc4j.jms.usePersistenceLockFiles=false com.evermind.server.OC4JServer -config C:\jdev1012\jdev\system10.1.2.2.0.1929\oc4j-config\server.xml
    [waiting for the server to complete its initialization...]
    07/05/07 14:39:27 Auto-deploying file:/C:/jdev1012/jdev/mywork/NewslineArchive/ViewController/public_html/ (New server version detected)...
    Ready message received from Oc4jNotifier.
    Embedded OC4J startup time: 2404 ms.
    Target URL -- http://10.141.146.47:8988/NewslineArchive/jsps/index.jsp
    07/05/07 14:39:28 Oracle Application Server Containers for J2EE 10g (10.1.2.2.0) initialized
    May 7, 2007 2:39:28 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    May 7, 2007 2:39:28 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
    May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='newslinearchive.view.ApplicationResources', returnNull=true
    May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    May 7, 2007 2:39:29 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.bean.LocalStrings', returnNull=true
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA897800000001000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A4877800000002000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA6F7800000003000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA717800000004000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA737800000005000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA757800000006000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA777800000007000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA797800000008000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA7D7800000009000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA83780000000A000001126844BC10
    07/05/07 14:39:35 getQueryHitCount returns the value: 12
    07/05/07 14:39:35 EditApplicantAction.prepareModel() - No events
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA89780000000B000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A487780000000C000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA6F780000000D000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA71780000000E000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA73780000000F000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA757800000010000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA777800000011000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA797800000012000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA7D7800000013000001126844BC10
    07/05/07 14:39:35 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA837800000014000001126844BC10
    May 7, 2007 2:39:35 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    May 7, 2007 2:39:36 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    07/05/07 14:39:36 getQueryHitCount returns the value: 12
    07/05/07 14:39:39 *** EditNewslineArchiveAction.prepareModel() - before super call
    07/05/07 14:39:39 *** EditNewslineArchiveAction.prepareModel() - after super call
    07/05/07 14:39:39 *** EditNewslineArchiveAction.findForward() - before super call
    07/05/07 14:39:39 *** EditNewslineArchiveAction.findForward() - after super call
    May 7, 2007 2:39:39 PM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    07/05/07 14:39:44 *** EditNewslineArchiveAction.prepareModel() - before super call
    07/05/07 14:39:44 *** EditNewslineArchiveAction.prepareModel() - after super call
    oracle.jbo.RowNotFoundException: JBO-25020: View row of key oracle.jbo.Key[238727 ] not found in SearchRefCursor1.
    at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.getRowFromKey(RuntimeViewRowSetIteratorInfo.java:505)
    at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.getRowForSvcMsg(RuntimeViewRowSetIteratorInfo.java:471)
    at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.processChanges(RuntimeViewRowSetIteratorInfo.java:367)
    at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.postRows(AbstractRemoteApplicationModuleImpl.java:3433)
    at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processSvcMsgRequest(AbstractRemoteApplicationModuleImpl.java:3480)
    at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processSvcMsgEntries(AbstractRemoteApplicationModuleImpl.java:4129)
    at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.readServiceMessage(AbstractRemoteApplicationModuleImpl.java:3389)
    at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:1859)
    at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7355)
    at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:1825)
    at oracle.jbo.server.remote.colo.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:263)
    at oracle.jbo.common.colo.ColoApplicationModuleImpl.doMessage(ColoApplicationModuleImpl.java:103)
    at oracle.jbo.client.remote.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:6375)
    at oracle.jbo.client.remote.PooledRequestHandler.doMessage(PooledRequestHandler.java:130)
    at oracle.jbo.client.remote.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:6375)
    at oracle.jbo.client.remote.ApplicationModuleImpl.sendServiceMessage(ApplicationModuleImpl.java:1100)
    at oracle.jbo.client.remote.ApplicationModuleImpl.sendServiceMessage(ApplicationModuleImpl.java:1114)
    at oracle.jbo.client.remote.ApplicationModuleImpl.sendWorkingSetRequests(ApplicationModuleImpl.java:3497)
    at oracle.jbo.common.ws.WSApplicationModuleImpl.sendRequests(WSApplicationModuleImpl.java:1119)
    at oracle.jbo.client.remote.ApplicationModuleImpl.sendRequest(ApplicationModuleImpl.java:1148)
    at oracle.jbo.client.remote.ApplicationModuleImpl.validate(ApplicationModuleImpl.java:810)
    at oracle.adf.model.bc4j.DCJboDataControl.validate(DCJboDataControl.java:967)
    at oracle.adf.model.binding.DCBindingContainer.validateInputValues(DCBindingContainer.java:1683)
    at oracle.adf.controller.lifecycle.PageLifecycle.validateModelUpdates(PageLifecycle.java:465)
    at oracle.adf.controller.struts.actions.DataAction.validateModelUpdates(DataAction.java:327)
    at oracle.adf.controller.struts.actions.DataAction.validateModelUpdates(DataAction.java:519)
    at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:115)
    at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:222)
    at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:153)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:669)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    07/05/07 14:39:44 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA897800000015000001126844E401
    07/05/07 14:39:44 *** EditNewslineArchiveAction.findForward() - before super call
    07/05/07 14:39:44 *** EditNewslineArchiveAction.findForward() - after super call
    07/05/07 14:39:46 *** EditNewslineArchiveAction.prepareModel() - before super call
    07/05/07 14:39:46 *** EditNewslineArchiveAction.prepareModel() - after super call
    07/05/07 14:39:46 *** EditApplicantAction.onSubmmit() ***
    07/05/07 14:39:46 Current Row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A487780000000C000001126844BC10
    07/05/07 14:39:46 *** EditNewslineArchiveAction.findForward() - before super call
    07/05/07 14:39:46 *** EditNewslineArchiveAction.findForward() - after super call
    07/05/07 14:39:48 *** EditNewslineArchiveAction.prepareModel() - before super call
    07/05/07 14:39:48 *** EditNewslineArchiveAction.prepareModel() - after super call
    07/05/07 14:39:48 *** EditApplicantAction.onSave() ***
    07/05/07 14:39:48 Current Row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A487780000000C000001126844BC10
    07/05/07 14:39:48 masterId = 238727
    07/05/07 14:39:48 displayName = test
    07/05/07 14:39:48 *** NewslineArchiveServceImpl.updateNewslineArchiveItem(String masterId, String displayName) ***
    07/05/07 14:39:48 *** EditNewslineArchiveAction.findForward() - before super call
    07/05/07 14:39:48 *** EditNewslineArchiveAction.findForward() - after super call
    07/05/07 14:39:48 EditApplicantAction.prepareModel() - No events
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA897800000016000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000303A4877800000017000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA6F7800000018000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA717800000019000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA73780000001A000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA75780000001B000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA77780000001C000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA79780000001D000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA7D780000001E000001126844BC10
    07/05/07 14:39:49 row.key = 000100000124ACED0005737200146A6176612E6D6174682E426967446563696D616C54C71557F981284F0200024900057363616C654C0006696E7456616C7400164C6A6176612F6D6174682F426967496E74656765723B787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B020000787000000000737200146A6176612E6D6174682E426967496E74656765728CFC9F1FA93BFB1D030006490008626974436F756E744900096269744C656E67746849001366697273744E6F6E7A65726F427974654E756D49000C6C6F776573745365744269744900067369676E756D5B00096D61676E69747564657400025B427871007E0002FFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFE00000001757200025B42ACF317F8060854E002000078700000000302EA83780000001F000001126844BC10
    07/05/07 14:39:49 getQueryHitCount returns the value: 12
    Any help or direction to find an answer would be greatly appreciated!
    Thanks, Ken

    More information -
    ==> Select Edit on Row in table - Primarykey=238727
    07/05/08 10:15:51 *** ShowNewslineArchiveAction.findForward() ***
    May 8, 2007 10:15:51 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    May 8, 2007 10:15:51 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    07/05/08 10:15:51 getQueryHitCount returns the value: 12
    07/05/08 10:15:54 ShowNewslineArchiveAction.prepareModel() - has events
    07/05/08 10:15:54 *** ShowNewslineArchiveAction.findForward() ***
    07/05/08 10:15:54 ShowNewslineArchiveAction.findForward()- event : setCurrentRowWithKey
    07/05/08 10:15:54 ShowNewslineArchiveAction.findForward()- event : Edit
    Forward "Edit" points to this page
    07/05/08 10:15:54 *** EditNewslineArchiveAction.prepareModel() - before super call
    07/05/08 10:15:54 *** EditNewslineArchiveAction.prepareModel() - after super call
    07/05/08 10:15:54 *** EditNewslineArchiveAction.findForward() ***
    07/05/08 10:15:54 Key.getAttribute(0) = 238727
    07/05/08 10:15:54 *** EditNewslineArchiveAction.findForward() - before super call
    07/05/08 10:15:54 *** EditNewslineArchiveAction.findForward() - after super call
    May 8, 2007 10:15:54 AM org.apache.struts.util.PropertyMessageResources <init>
    INFO: Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
    ==> Set value in displayname field to another value, press submit button - no processing in onSubmit()
    07/05/08 10:15:59 *** EditNewslineArchiveAction.prepareModel() - before super call
    07/05/08 10:15:59 *** EditNewslineArchiveAction.prepareModel() - after super call
    07/05/08 10:16:00 Key.getAttribute(0) = 191113
    oracle.jbo.RowNotFoundException: JBO-25020: View row of key oracle.jbo.Key[238727 ] not found in SearchRefCursor1.
    at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.getRowFromKey(RuntimeViewRowSetIteratorInfo.java:505)
    07/05/08 10:16:00 *** EditNewslineArchiveAction.findForward() ***
    07/05/08 10:16:00 EditNewslineArchiveAction.findForward()- event : Submit
    07/05/08 10:16:00 *** EditNewslineArchiveAction.findForward() - before super call
    07/05/08 10:16:00 *** EditNewslineArchiveAction.findForward() - after super call
    At this point See error message with RowNotFoundException. Don't understand where key was changed from 238727 to 191113 (first record in recordset.)
    ==> Press submit again - works how it should have from start
    07/05/08 10:16:01 *** EditNewslineArchiveAction.prepareModel() - before super call
    07/05/08 10:16:01 *** EditNewslineArchiveAction.prepareModel() - after super call
    07/05/08 10:16:01 *** EditApplicantAction.onSubmmit() ***
    07/05/08 10:16:01 Key.getAttribute(0) = 238727
    07/05/08 10:16:01 *** EditNewslineArchiveAction.findForward() ***
    07/05/08 10:16:01 EditNewslineArchiveAction.findForward()- event : Submit
    07/05/08 10:16:01 *** EditNewslineArchiveAction.findForward() - before super call
    07/05/08 10:16:01 *** EditNewslineArchiveAction.findForward() - after super call
    I looked at section" 7.9 Summary of Difference Between Entity-Based View Objects and Read-Only View Objects" in Oracle Applicatin Development Framework Developer's Guide for Forms/4GL Developers. Since I am using a ViewObject based on a REF CURSOR, I added the setManageRowsByKey(true); in the create() method of my ViewObject. This didn't help.
    Any suggestions?
    Thanks, Ken

  • Ref cursors don't work in declared procedures?

    It appears that ref cursors in declared procedures don't work.
    For example, the following code runs with no errors, but returns nothing from the ref cursor -
    s = s & "DECLARE" & vbLf
    s = s & " TYPE OutCurType IS REF CURSOR;" & vbLf
    s = s & "PROCEDURE xxxProc(p5 in out OutCurType )" & vbLf
    s = s & " AS" & vbLf
    s = s & "BEGIN" & vbLf
    s = s & " OPEN p5 FOR SELECT * FROM table;" & vbLf
    s = s & "END xxxProc;" & vbLf
    s = s & "BEGIN" & vbLf
    s = s & " xxxProc( :p5 );" & vbLf
    s = s & "END;" & vbLf
    oCmd.CommandText = s
    oCmd.CommandType = CommandType.Text
    oParam6.ParameterName = "p5"
    oParam6.OracleDbType = Oracle.DataAccess.Client.OracleDbType.RefCursor
    oParam6.Direction = ParameterDirection.Output
    oParam6.Value = DBNull.Value
    oCmd.Parameters.Add(oParam6)
    oCmd.ExecuteNonQuery()
    oDR = CType(oCmd.Parameters("p5").Value, Oracle.DataAccess.Types.OracleRefCursor).GetDataReader
    While oDR.Read
    Stop
    End While
    However, a previously created procedure executes fine, in the above code -
    s = "BEGIN" & vbLf
    s = s & " xxxPkg.xxxProc( :p5 );" & vbLf
    s = s & "END;" & vbLf
    Is there a way to get ref cursors to work in declared procedures? Thanks...

    Fixed the grid cell display and popup editor for Ref Cursors.
    -Raghu

  • DESCRIBING A REF CURSOR

    For debugging purposes, I would like to be able to describe a REF CURSOR returned by a function in a package, using pl/sql.
    Can you help me ?

    ZlatKo
    A brave attempt and well done for putting up with the forum software.
    Alas, I can't catually run the code - I get the following error-stack. I'll have another go at it this lunchtime.
    If I'm not mistaken your procedure would give us a visual output of the REF CURSOR structure, just like DESC. I think the original poster was after something they could use programmatically inside a PL/SQL procedure to interrogate and process a REF CURSOR with an unknown signature. It would be possible to walk the structure as you do, suck out the values and store them in arrays. Fine. But without knowing the column names how do we know what to do with these values?
    At some point the receiving program has to know what the purpose of the REF CURSOR. We can imagine a function that generates a REF CURSOR from one of three queries depending upon the value of an input parameter. Every program which calls that function must pass in that parameter and therefore must know the signature of the REF CURSOR that it gets back.
    The idea of a function returning data at its own whim is a bit laughable. Even web services, surely the ultimate expression of the encapsulation paradigm, insist on the publication of a signature - what we have to put in, what we will get back.
    Cheers, APC

  • Reading a ref cursor containing a cursor throws AccessViolationException

    Apologies if this is a known bug. Documenting the simplest case I could find to reproduce it.
    Oracle 10g Release 2 (10.2.0.1.0)
    ODP.NET 2.102.2.10
    Windows XP SP2 32-bit, .Net 2.0.50727
    First, create a simple function that returns a very simple ref cursor:
    =======================
    create or replace function test_get_child_cursor
    return sys_refcursor
    is
         ret_results sys_refcursor;
    begin
         open ret_results for
         select 1 as child_id from dual;
         return ret_results;
    end;
    =======================
    Then try to execute a select that calls this function in ODP.NET:
    =======================
    OracleCommand cmd = conn.CreateCommand();
    cmd.CommandText = "begin open :1 for select 1 as id, test_get_child_cursor() from dual; end;";
    cmd.Parameters.Add("cur", OracleDbType.RefCursor, ParameterDirection.Output);
    cmd.ExecuteNonQuery();
    OracleDataReader reader = ((OracleRefCursor) cmd.Parameters["cur"].Value).GetDataReader();
    while (reader.Read())
    =======================
    Getting the following error when calling reader.Read():
    =======================
    System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at Oracle.DataAccess.Client.OpsDac.Read(IntPtr opsConCtx, IntPtr opsErrCtx, IntPtr opsSqlCtx, IntPtr& opsDacCtx, OpoSqlValCtx* pOpoSqlValCtx, OpoMetValCtx* pOpoMetValCtx, OpoDacValCtx* pOpoDacValCtx)
    at Oracle.DataAccess.Client.OracleDataReader.Read()
    =======================
    Is this a supported feature at all in this version of ODP.NET (i.e., reading from a ref cursor that contains other ref cursors)?
    We have several places in our application where we'd like to get cursors containing cursors, so we just want to plan ahead if this is going to be supported.
    Thanks,
    Jeremy

    Hello,
    A bit old, but still relevant:
    Cursor expression & .NET
    Nested cursors are not supported by ODP.NET.
    - Mark

  • TYPE REF CURSOR

    I have two packages (please see below). A procedure from the first package (TEST1) calls a procedure in the second package (TEST2), which has an output parameter of REF CURSOR TYPE.
    I am getting an error at compile time, in the calling procedure.
    Can anyone please help on finding out what am I missing here?
    Thank you in advance.
    - Ketan Bhuptani
    Here are the procedures:
    (1)
    CREATE OR REPLACE PACKAGE TEST1
    AS
    TYPE cursor_type_pass IS REF CURSOR;
    PROCEDURE call_cursor (result_flag OUT varchar2);
    END TEST1;
    CREATE OR REPLACE PACKAGE BODY TEST1
    AS
    PROCEDURE call_cursor (result_flag OUT varchar2) IS
    v_salary int;
    proc_cursor cursor_type_pass;
    CURSOR emp_cur is select empid from emp;
    BEGIN
    FOR emp_cur_var IN emp_cur
    LOOP
    test2.open_cursor(emp_cur_var.empid, proc_cursor);
    v_salary := proc_cursor.salary;
         -- getting an error Invalid reference to variable proc_cursor at this line
    END LOOP;
    END call_cursor;
    END TEST1;
    (2)
    CREATE OR REPLACE PACKAGE TEST2
    AS
    TYPE cursor_type_return IS REF CURSOR;
    PROCEDURE open_cursor (emp_id IN varchar2, out_cur OUT cursor_type_return);
    END TEST2;
    CREATE OR REPLACE PACKAGE BODY TEST2
    AS
    PROCEDURE open_cursor (emp_id IN varchar2, out_cur OUT cursor_type_return) IS
    BEGIN
    OPEN out_cur FOR
    select location, salary from emp_information where empid = emp_id;
    END open_cursor;
    END TEST2;
    create table emp_information
    (location varchar2(30), salary int, empid varchar2(10));
    create table emp
    (empid varchar2(10));

    Your scenario is not very clear to me, but let us do some test coding here, see if it helps you,SQL> create or replace package test_pkg1 as
      2  TYPE cursor_type1 IS REF CURSOR;
      3  procedure proc1;
      4  end;
      5  /
    Package created.
    SQL> create or replace package test_pkg2 as
      2  TYPE cursor_type2 IS REF CURSOR;
      3  procedure proc2(pCur IN OUT cursor_type2);
      4  end;
      5  /
    Package created.
    SQL> create or replace package body test_pkg2 as
      2  procedure proc2(pCur IN OUT cursor_type2) is
      3  begin
      4      open pCur for SELECT ename from  my_emp;
      5  end;
      6  end;
      7  /
    Package body created.
    SQL> create or replace package body test_pkg1 as
      2  procedure proc1 is
      3  vRefCur    cursor_type1;
      4  vEname     VARCHAR2(20);
      5  vRefCur2   test_pkg2.cursor_type2;
      6  begin
      7    test_pkg2.proc2(vRefCur); -- this is possible, but I do not like it.
      8    vRefCur2 := vRefCur; -- you can also do this, but you have no reason to do this
      9    loop
    10      fetch vRefCur2 into vEname;
    11      exit when vRefCur2%NOTFOUND;
    12      dbms_output.put_line(vEname);
    13    end loop;
    14    close vRefCur2;
    15  end;
    16  end;
    17  /
    Package body created.
    SQL> exec test_pkg1.proc1;
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.
    Let us make it simple,
    SQL> create or replace package body test_pkg1 as
      2  procedure proc1 is
      3  vRefCur    cursor_type1;
      4  vEname     VARCHAR2(20);
      5  --vRefCur2   test_pkg2.cursor_type2;
      6  begin
      7    test_pkg2.proc2(vRefCur);
      8    --vRefCur2 := vRefCur;
      9    loop
    10      fetch vRefCur into vEname;
    11      exit when vRefCur%NOTFOUND;
    12      dbms_output.put_line(vEname);
    13    end loop;
    14    close vRefCur;
    15  end;
    16  end;
    17  /
    Package body created.
    SQL> exec test_pkg1.proc1;
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    PL/SQL procedure successfully completed.You can play with it number of different ways.
    Let me know what questions and we will take it from there.
    Thx,
    SriDHAR

  • PLS-00428 Why SELECT must be adorned with REF CURSOR to work?

    hello
    *"PLS-00428: an INTO clause is expected in this SELECT statement"* - This problem has been resolved. I just want to understand WHY SELECT statements need to be paired with REF CURSOR.
              To reproduce this,
                   DECLARE
                        Id1 numeric(19,0);
                        Id2 numeric(19,0);
                        CreateTimestamp date;
                   BEGIN
                   -- ATTN: You'd either need to select into variable or open cursor!
                   select * from SystemUser left join Person on Person.Id = SystemUser.PersonId WHERE Person.PrimaryEmail in ('[email protected]','[email protected]');
                   END;
              Solution?
                   * In install script:
                        CREATE OR REPLACE PACKAGE types
                        AS
                             TYPE cursorType IS REF CURSOR;
                        END;
                   * Then in your query:
                        DECLARE
                             Id1 numeric(19,0);
                             Id2 numeric(19,0);
                             Result_cursor types.cursorType;
                        BEGIN
                        OPEN Result_cursor FOR select * from SystemUser left join Person on Person.Id = SystemUser.PersonId WHERE Person.PrimaryEmail in ('[email protected]','[email protected]');
                        END;
    I Googled for reasonable explaination - closest is: http://www.tek-tips.com/viewthread.cfm?qid=1338078&page=34
    That in oracle block or procedures are expected to do something and a simple SELECT is not!! (Very counter intuitive). What needs to be done is therefore to put the select output into a ref-cursor to fool oracle so that it thinks the procedure/block is actually doing something. Is this explanation right? Sounds more like an assertion than actually explaining...
    Any suggestion please? Thanks!

    Opening a cursor (ref cursor or otherwise) is not the same as executing a select statement.
    A select statement returns data, so if you are using it inside PL/SQL code it has to return that data into something i.e. a local variable or structure. You can't just select without a place for the data to go.
    Opening a cursor issues the query against the database and provides a pointer (the ref cursor), but at that point, no data has been retrieved. The pointer can then be used or passed to some other procedure or code etc. so that it may then fetch the data into a variable or structure as required.
    It's not counter-intuitive at all. It's very intuitive.

Maybe you are looking for