Ref Cursors in 10g
Hi,
I have a problem. A PL/SQL code was running fine in 9i as per the required output(dbmsoutput) ,is not working in 10g.
The following is the PART OF THE CODE.
In 9i database the output reaches till 'TEST5' but not in 10gdatabase,where it reaches till 'TEST4'.
FOR tab1 IN c_tablename
LOOP
var_tablename := tab1.tname;
DBMS_OUTPUT.put_line(var_tablename);
var_string1 := 'select distinct uo.type from udb_object uo ,'||var_tablename||' a where uo.object = a.object';
DBMS_OUTPUT.put_line('TEST2');
DBMS_OUTPUT.put_line(var_string1);
DBMS_OUTPUT.put_line('TEST4');
OPEN var_table1 FOR var_string1;
LOOP
DBMS_OUTPUT.put_line('TEST5');
FETCH var_table1 INTO var_type;
PLease let me know is you know anything around.
Regards
Vallabh
Hi
Here is the program
CREATE OR REPLACE PROCEDURE udb_object_final(var_name VARCHAR2)
IS
var_type NUMBER;
var_tablename VARCHAR (80);
var_columnname VARCHAR (80);
CURSOR c_tablename
IS
SELECT tname
FROM TAB
WHERE UPPER(tname) = UPPER(var_name);
CURSOR c_columnname
IS
SELECT utc.column_name cname
FROM ALL_tab_columns utc
WHERE utc.table_name =UPPER(var_tablename);
err_msg1 VARCHAR (80);
err_msg VARCHAR (80);
err_code NUMBER;
var_percentage NUMBER;
var_count1 NUMBER := 0;
TYPE c_table1 IS REF CURSOR;
var_table1 c_table1;
var_string1 VARCHAR2 (4000);
TYPE c_table2 IS REF CURSOR;
var_table2 c_table2;
var_string2 VARCHAR2 (4000);
var_count2 NUMBER (38);
TYPE c_table3 IS REF CURSOR;
var_table3 c_table3;
var_string3 VARCHAR2 (4000);
var_count3 NUMBER (38);
BEGIN
DBMS_OUTPUT.put_line('TEST1');
FOR tab1 IN c_tablename
LOOP
var_tablename := tab1.tname;
DBMS_OUTPUT.put_line(var_tablename);
var_string1 := 'select distinct uo.type from udb_object uo ,'||var_tablename||' a where uo.object = a.object';
DBMS_OUTPUT.put_line('TEST2');
DBMS_OUTPUT.put_line(var_string1);
DBMS_OUTPUT.put_line('TEST4');
OPEN var_table1 FOR var_string1;
LOOP
DBMS_OUTPUT.put_line('TEST5');
FETCH var_table1 INTO var_type;
DBMS_OUTPUT.put_line(var_count1);
var_string2 :='select count(*) from '||var_tablename||' tt, udb_object uo where uo.type='||var_type||' and tt.object = uo.object ';
OPEN var_table2 FOR var_string2;
FETCH var_table2 INTO var_count2;
CLOSE var_table2;
FOR tab2 IN c_columnname
LOOP
var_columnname := tab2.cname;
var_string3 :='select count(*) from '||var_tablename|| ' where '||var_columnname|| ' is NOT NULL and object in (select object from udb_object where type = '||var_type|| ')';
OPEN var_table3 FOR var_string3;
FETCH var_table3 INTO var_count3;
CLOSE var_table3;
IF (var_count3 = 0)
THEN
var_percentage := 0;
ELSE
var_percentage := ROUND((var_count3/var_count2)*100);
END IF;
DBMS_OUTPUT.put_line ( var_tablename||'='|| var_columnname||': '||var_type||': '|| var_percentage);
END LOOP;
EXIT WHEN var_table1%NOTFOUND;
END LOOP;
CLOSE var_table1;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.put_line ('NO CORRESPONDING OBJECTS FOUND IN UDB_OBJECT');
WHEN OTHERS
THEN
err_code := SQLCODE;
err_msg := SUBSTR (SQLERRM, 1, 100);
END udb_object_final;
Cheers
Vallabh
Similar Messages
-
Is Ref Cursor Supported in Froms 10g . If not is there any built-ins
Hi Experts,
I need to use ref cursor in my from 10g. My cursor query should be dynamically append the "where clause column name". Hence I used the dynamic query with ref cursor.
But my problem is , when I compile the form it gives error "this feature is not supported in clinet-side programs'
Is there any solution for this in forms?
Will "EXEC_SQL" package works.
Is there any alternative other than writing pl/sql refcursor....
Thanks
JanaThere are only strong ref cursors allowed in forms (they are not dynamic). you can use exec_sql in forms, or you can use a record group to do dynamic sql. Third option would be to write a database procedure where you can make use ref cursors.
regards -
Using plsql table and ref cursor in oracle forms 10g
Hi all,
Can anyone give me an example of a scenario where we need to create a form manually based on a database stored procedures.
And in that procedure i have created a pl/sql table and a ref cursor in data base level.
CREATE OR REPLACE PACKAGE SCOTT.BONUS_PKG IS TYPE bonus_rec
IS RECORD(
empno bonus_EMP.empno%TYPE,
ename bonus_EMP.ename%TYPE,
job bonus_EMP.job%TYPE,
sal bonus_EMP.sal%TYPE,
comm bonus_EMP.comm%TYPE);
TYPE b_cursor IS REF CURSOR RETURN bonus_rec;
TYPE bontab IS TABLE OF bonus_rec INDEX BY BINARY_INTEGER;
PROCEDURE bonus_refcur(bonus_data IN OUT b_cursor);
PROCEDURE bonus_query(bonus_data IN OUT bontab);
END bonus_pkg;
CREATE OR REPLACE PACKAGE BODY SCOTT.BONUS_PKG IS
PROCEDURE bonus_query(bonus_data IN OUT bontab) IS
ii NUMBER;
CURSOR bonselect IS
SELECT empno, ename, job, sal, comm FROM bonus_EMP ORDER BY empno;
BEGIN
OPEN bonselect;
ii := 1;
LOOP
FETCH bonselect INTO
bonus_data( ii ).empno,
bonus_data( ii ).ename,
bonus_data( ii ).job,
bonus_data( ii ).sal,
bonus_data( ii ).comm;
EXIT WHEN bonselect%NOTFOUND;
ii := ii + 1;
END LOOP;
END bonus_query;
PROCEDURE bonus_refcur(bonus_data IN OUT b_cursor) IS
BEGIN
OPEN bonus_data FOR SELECT empno, ename, job, sal, comm FROM bonus_EMP ORDER BY empno;
END bonus_refcur;
END bonus_pkg;
i want to populate the data in forms manually not using forms data block wizard and programmatically.
please reply...Can anyone give me an example of a scenario where we need to create a form manually based on a database stored procedures.Typically, you would use a procedure based block when you have a collection of data from multiple tables presented in a Form and your user needs to be able to update the information displayed.
From your code example, it looks like you are using Oracle Support document "Basing a Block on a Stored Procedure - Sample Code [ID 66887.1]". If this is the case, keep following the document - it walks you through all of the steps. There is no need to Manually configure things that the Data Block Wizard will perform for you!
i want to populate the data in forms manually not using forms data block wizard and programmatically. Why? Let the Data Block Wizard take care of configuring your block based on a procedure for you. There is no need to manually loop through the data! I've actually done what you are attempting and it was more work than was needed. Let Forms do the work for you. :)
If you absolutely must do things manually, I recommend you use the PROCEDURE bonus_query(bonus_data IN OUT bontab) instead of the bonus_refcur(bonus_data IN OUT b_cursor) . Then, in your code create a variable of type BONTAB and then call the bonus_query procedure. Then it is a simple case of looping through the table of records returned by the bonus_query procedure. For example:
DECLARE
t_bonus bonus_pkb.bontab;
BEGIN
bonus_pkg.bonus_query(t_bonus);
FOR i in 1 .. t_bonus.count LOOP
:YOUR_BLOCK.EMPLOYEE_NUMBER := t_bonus(i).empno;
:YOUR_BLOCK.EMPLOYEE_NAME := t_bonus(i).ename;
:YOUR_BLOCK.EMPLOYEE_JOB := t_bonus(i).job;
:YOUR_BLOCK.EMPLOYEE_SALARY := t_bonus(i).sal;
:YOUR_BLOCK.EMPLOYEE_COMMISSION := t_bonus(i).comm;
END LOOP;
END;This code sample demonstrates the basics, but as it is sample code - you will have to adapt it to your situation.
Also, I strongly recommend you look at the article InoL listed. This is a very comprehensive discussion on REF CURSORs. If you are set on using a procedure based data source - it is more efficient to pass the table of records back to your form than it is to pass a ref cursor. Using a ref cursor, you might as well just using a standard named cursor and loop through your named cursor. The effect is the same (one row returned at a time creating lots of network traffic). Using the table of records is more efficient because the entire data set is returned so network traffic is reduced.
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
ORA-01008 with ref cursor and dynamic sql
When I run the follwing procedure:
variable x refcursor
set autoprint on
begin
Crosstab.pivot(p_max_cols => 4,
p_query => 'select job, count(*) cnt, deptno, row_number() over (partition by job order by deptno) rn from scott.emp group by job, deptno',
p_anchor => Crosstab.array('JOB'),
p_pivot => Crosstab.array('DEPTNO', 'CNT'),
p_cursor => :x );
end;I get the following error:
^----------------
Statement Ignored
set autoprint on
begin
adsmgr.Crosstab.pivot(p_max_cols => 4,
p_query => 'select job, count(*) cnt, deptno, row_number() over (partition by
p_anchor => adsmgr.Crosstab.array('JOB'),
p_pivot => adsmgr.Crosstab.array('DEPTNO', 'CNT'),
p_cursor => :x );
end;
ORA-01008: not all variables bound
I am running this on a stored procedure as follows:
create or replace package Crosstab
as
type refcursor is ref cursor;
type array is table of varchar2(30);
procedure pivot( p_max_cols in number default null,
p_max_cols_query in varchar2 default null,
p_query in varchar2,
p_anchor in array,
p_pivot in array,
p_cursor in out refcursor );
end;
create or replace package body Crosstab
as
procedure pivot( p_max_cols in number default null,
p_max_cols_query in varchar2 default null,
p_query in varchar2,
p_anchor in array,
p_pivot in array,
p_cursor in out refcursor )
as
l_max_cols number;
l_query long;
l_cnames array;
begin
-- figure out the number of columns we must support
-- we either KNOW this or we have a query that can tell us
if ( p_max_cols is not null )
then
l_max_cols := p_max_cols;
elsif ( p_max_cols_query is not null )
then
execute immediate p_max_cols_query into l_max_cols;
else
RAISE_APPLICATION_ERROR(-20001, 'Cannot figure out max cols');
end if;
-- Now, construct the query that can answer the question for us...
-- start with the C1, C2, ... CX columns:
l_query := 'select ';
for i in 1 .. p_anchor.count
loop
l_query := l_query || p_anchor(i) || ',';
end loop;
-- Now add in the C{x+1}... CN columns to be pivoted:
-- the format is "max(decode(rn,1,C{X+1},null)) cx+1_1"
for i in 1 .. l_max_cols
loop
for j in 1 .. p_pivot.count
loop
l_query := l_query ||
'max(decode(rn,'||i||','||
p_pivot(j)||',null)) ' ||
p_pivot(j) || '_' || i || ',';
end loop;
end loop;
-- Now just add in the original query
l_query := rtrim(l_query,',')||' from ( '||p_query||') group by ';
-- and then the group by columns...
for i in 1 .. p_anchor.count
loop
l_query := l_query || p_anchor(i) || ',';
end loop;
l_query := rtrim(l_query,',');
-- and return it
execute immediate 'alter session set cursor_sharing=force';
open p_cursor for l_query;
execute immediate 'alter session set cursor_sharing=exact';
end;
end;
/I can see from the error message that it is ignoring the x declaration, I assume it is because it does not recognise the type refcursor from the procedure.
How do I get it to recognise this?
Thank you in advanceThank you for your help
This is the version of Oracle I am running, so this may have something to do with that.
Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production
I found this on Ask Tom (http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3027089372477)
Hello, Tom.
I have one bind variable in a dynamic SQL expression.
When I open cursor for this sql, it gets me to ora-01008.
Please consider:
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
JServer Release 8.1.7.4.1 - Production
SQL> declare
2 type cur is ref cursor;
3 res cur;
4 begin
5 open res for
6 'select * from (select * from dual where :p = 1) connect by 1 = 1'
7 using 1;
8 end;
9 /
declare
ERROR at line 1:
ORA-01008: not all variables bound
ORA-06512: at line 5
SQL> declare
2 type cur is ref cursor;
3 res cur;
4 begin
5 open res for
6 'select * from (select * from dual where :p = 1) connect by 1 = 1'
7 using 1, 2;
8 end;
9 /
PL/SQL procedure successfully completed.
And if I run the same thing on 10g -- all goes conversely. The first part runs ok, and the second
part reports "ORA-01006: bind variable does not exist" (as it should be, I think). Remember, there
is ONE bind variable in sql, not two. Is it a bug in 8i?
What should we do to avoid this error running the same plsql program code on different Oracle
versions?
P.S. Thank you for your invaluable work on this site.
Followup June 9, 2005 - 6pm US/Eastern:
what is the purpose of this query really?
but it would appear to be a bug in 8i (since it should need but one). You will have to work that
via support. I changed the type to tarray to see if the reserved word was causing a problem.
variable v_refcursor refcursor;
set autoprint on;
begin
crosstab.pivot (p_max_cols => 4,
p_query =>
'SELECT job, COUNT (*) cnt, deptno, ' ||
' ROW_NUMBER () OVER ( ' ||
' PARTITION BY job ' ||
' ORDER BY deptno) rn ' ||
'FROM emp ' ||
'GROUP BY job, deptno',
p_anchor => crosstab.tarray ('JOB'),
p_pivot => crosstab.tarray ('DEPTNO', 'CNT'),
p_cursor => :v_refcursor);
end;
/Was going to use this package as a stored procedure in forms but I not sure it's going to work now. -
How can I iterate over the columns of a REF CURSOR?
I have the following situation:
DECLARE
text VARCHAR2 (100) := '';
TYPE gen_cursor is ref cursor;
c_gen gen_cursor;
CURSOR c_tmp
IS
SELECT *
FROM CROSS_TBL
ORDER BY sn;
BEGIN
FOR tmp IN c_tmp
LOOP
text := 'select * from ' || tmp.table_name || ' where seqnum = ' || tmp.sn;
OPEN c_gen FOR text;
-- here I want to iterate over the columns of c_gen
-- c_gen will have different number of columns every time,
-- because we select from a different table
-- I have more than 500 tables, so I cannot define strong REF CURSOR types!
-- I need something like
l := c_gen.columns.length;
for c in c_gen.columns[1]..c_gen.columns[l]
LOOP
-- do something with the column value
END LOOP;
END LOOP;
END;As you can see from the comments in the code, I couln'd find any examples on the internet with weak REF CURSORS and selecting from many tables.
What I found was:
CREATE PACKAGE admin_data AS
TYPE gencurtyp IS REF CURSOR;
PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT);
END admin_data;
CREATE PACKAGE BODY admin_data AS
PROCEDURE open_cv (generic_cv IN OUT gencurtyp, choice INT) IS
BEGIN
IF choice = 1 THEN
OPEN generic_cv FOR SELECT * FROM employees;
ELSIF choice = 2 THEN
OPEN generic_cv FOR SELECT * FROM departments;
ELSIF choice = 3 THEN
OPEN generic_cv FOR SELECT * FROM jobs;
END IF;
END;
END admin_data;
/But they have only 3 tables here and I have like 500. What can I do here?
Thanks in advance for any help!The issue here is that you don't know your columns at design time (which is generally considered bad design practice anyway).
In 10g or before, you would have to use the DBMS_SQL package to be able to iterate over each of the columns that are parsed from the query... e.g.
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
v_v_val VARCHAR2(4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.DESC_TAB;
col_num NUMBER;
v_rowcount NUMBER := 0;
BEGIN
-- create a cursor
c := DBMS_SQL.OPEN_CURSOR;
-- parse the SQL statement into the cursor
DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
-- execute the cursor
d := DBMS_SQL.EXECUTE(c);
-- Describe the columns returned by the SQL statement
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
-- Bind local return variables to the various columns based on their types
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val); -- Number
WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val); -- Date
ELSE
DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Any other type return as varchar2
END CASE;
END LOOP;
-- Display what columns are being returned...
DBMS_OUTPUT.PUT_LINE('-- Columns --');
FOR j in 1..col_cnt
LOOP
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
when 2 then 'NUMBER'
when 12 then 'DATE'
else 'Other' end);
END LOOP;
DBMS_OUTPUT.PUT_LINE('-------------');
-- This part outputs the DATA
LOOP
-- Fetch a row of data through the cursor
v_ret := DBMS_SQL.FETCH_ROWS(c);
-- Exit when no more rows
EXIT WHEN v_ret = 0;
v_rowcount := v_rowcount + 1;
DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
DBMS_OUTPUT.PUT_LINE('--------------');
-- Fetch the value of each column from the row
FOR j in 1..col_cnt
LOOP
-- Fetch each column into the correct data type based on the description of the column
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
ELSE
DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
END CASE;
END LOOP;
DBMS_OUTPUT.PUT_LINE('--------------');
END LOOP;
-- Close the cursor now we have finished with it
DBMS_SQL.CLOSE_CURSOR(c);
END;
SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
-- Columns --
EMPNO - NUMBER
ENAME - VARCHAR2
DEPTNO - NUMBER
SAL - NUMBER
Row: 1
EMPNO : 7782
ENAME : CLARK
DEPTNO : 10
SAL : 2450
Row: 2
EMPNO : 7839
ENAME : KING
DEPTNO : 10
SAL : 5000
Row: 3
EMPNO : 7934
ENAME : MILLER
DEPTNO : 10
SAL : 1300
PL/SQL procedure successfully completed.
SQL> exec run_query('select * from emp where deptno = 10');
-- Columns --
EMPNO - NUMBER
ENAME - VARCHAR2
JOB - VARCHAR2
MGR - NUMBER
HIREDATE - DATE
SAL - NUMBER
COMM - NUMBER
DEPTNO - NUMBER
Row: 1
EMPNO : 7782
ENAME : CLARK
JOB : MANAGER
MGR : 7839
HIREDATE : 09/06/1981 00:00:00
SAL : 2450
COMM :
DEPTNO : 10
Row: 2
EMPNO : 7839
ENAME : KING
JOB : PRESIDENT
MGR :
HIREDATE : 17/11/1981 00:00:00
SAL : 5000
COMM :
DEPTNO : 10
Row: 3
EMPNO : 7934
ENAME : MILLER
JOB : CLERK
MGR : 7782
HIREDATE : 23/01/1982 00:00:00
SAL : 1300
COMM :
DEPTNO : 10
PL/SQL procedure successfully completed.
SQL> exec run_query('select * from dept where deptno = 10');
-- Columns --
DEPTNO - NUMBER
DNAME - VARCHAR2
LOC - VARCHAR2
Row: 1
DEPTNO : 10
DNAME : ACCOUNTING
LOC : NEW YORK
PL/SQL procedure successfully completed.
SQL>From 11g onwards, you can create your query as a REF_CURSOR, but then you would still have to use the DBMS_SQL package with it's new functions to turn the refcursor into a dbms_sql cursor so that you can then describe the columns in the same way.
http://technology.amis.nl/blog/2332/oracle-11g-describing-a-refcursor
Welcome to the issues that are common when you start to attempt to create dynamic code. If your design isn't specific then your code can't be either and you end up creating more work in the coding whilst reducing the work in the design. ;) -
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:32Is 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. -
How to update data returned using REF CURSOR
Hi all,
I am trying to update updated data in a gridview but the update button seem to do nothing as i retrieve data using REF CURSOR.
Let me describe the architecture of my application first. I'm trying to implement best practice whenever possible. I am following the data access tutorial published in www.asp.net , the only difference is that i have an Oracle (10g) database. So I split my application into three layers, data access, business logic, and presentation layer. I'm also writing all queries in an Oracle package.
So I have my Oracle packages that perform CRUD operations. Then I have an xsd file that define dataTable based on the package procedure. My business logic layer then calls functions defined in the xsd file. And finally a detailsView control that uses an ObjectDataSource to call business logic functions.
In a nutshell, I am just trying to update records retrieved using REF CURSOR. Your help is very much appreciated. Please let me know if further details are required. Cheers,In the DataSet (xsd) where your DataTable is defined, you just need to add additional methods to the TableAdapter to handle insert, update and delete, either with SQL or by mapping to stored procedures.
Alternatively in code, create an OracleDataAdapter and supply its InsertCommand, UpdateCommand and DeleteCommand.
David -
How to call a Stored Procedure with a REF CURSOR output parameter
I am looking forward an example that call a stored function/procedure with a REF CURSOR output parameter and get the result.
In other words, I have a stored function/procedure that execute a SELECT statement using the OCI library and then it could get the values of each column and each row.
I put a code snippet, it have only the main thing to call a simple stored procedure and print the name of each column of the cursor, but I couldn´t to print out the values in the table that call the stored procedure.
I understand that the next step, it is to call a OCIStmtFetch.
How to associate the cursor with the OCIStmtFetch?
If you need more information, only tell me.
I am using ANSI C with HP-UX Operative System (C for HP-UX) and Oracle 10g.
Regards.
Antonio Garcia
/* callOracleSP */
#include <stdio.h>
#include <string.h>
#include <oci.h>
#include <stdlib.h>
char* pConnectChar ="server";
char* pUsernameChar = "user";
char* pPasswordChar = "passwd";
char* sqlCharArray1 = "BEGIN SP_GETCITIES(:s, :c); END;";
int retval;
ub4 parmcnt=0;
ub4 pos2=0;
text *pcoln[20];
ub4 namelen[20];
char state_key[5];
OCIStmt* pOciStatement;
OCIStmt* pOciStatCursor;
OCIError* pOciError;
OCIEnv* pOciEnviron;
OCIServer* pOciServer;
OCISession* pOciSession;
OCISvcCtx* pOciServiceContext;
OCIBind* pOciBind[500];
OCIParam* pOciParam;
int main()
retval = OCIEnvCreate(&pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL,0,NULL);
retval = OCIEnvInit(&pOciEnviron, OCI_DEFAULT, 0, NULL);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatement, OCI_HTYPE_STMT, 0, NULL);
retval = OCILogon(pOciEnviron,pOciError,&pOciServiceContext,(unsigned char *)pUsernameChar,
strlen(pUsernameChar), (unsigned char *)pPasswordChar, strlen(pPasswordChar),
(unsigned char *)pConnectChar,strlen(pConnectChar));
printf("OCILogon retval=%d\n",retval);
retval = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray1,strlen(sqlCharArray1),
OCI_NTV_SYNTAX, OCI_DEFAULT);
printf("StmtPrepare retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
retval = OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4) 1, (void *)&state_key,
(sb4) sizeof(state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *)&pOciStatCursor,
(sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
strcpy(state_key,"CA");
retval = OCIStmtExecute(pOciServiceContext, pOciStatement, pOciError, (ub4)1, (ub4) 0,
(OCISnapshot *)NULL, (OCISnapshot *)NULL, (ub4) OCI_DEFAULT);
printf("StmtExecute retval=%d\n",retval);
/* How to get the values of the cursor? */
/* Get number of parameters of the Cursor */
OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &parmcnt,(ub4 *) 0,
(ub4)OCI_ATTR_PARAM_COUNT, pOciError);
printf("\nNumber of parameters of the cursor = %d\n",parmcnt);
for (int pos = 1; pos <= (int)parmcnt; pos++)
OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &pos2,(ub4 *) 0,
(ub4)OCI_ATTR_CURRENT_POSITION, pOciError);
retval = OCIParamGet((void *)pOciStatCursor, (ub4)OCI_HTYPE_STMT, pOciError, (void **)&pOciParam,
(ub4) pos );
OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &pcoln[pos-1],(ub4 *) &namelen[pos-1],
(ub4) OCI_ATTR_NAME,(OCIError *)pOciError );
for (int i = 1; i <=(int)parmcnt; i++)
printf("Column %i\tNAME = %.*s\n",i,namelen[i-1],pcoln[i-1]);
return 0;
This is the script that create the table, insert records and create the stored procedure
CREATE TABLE CITIES (
STATE_CODE VARCHAR2(2) NULL,
CITY_CODE NUMBER(15,5) NULL,
CITY_NAME VARCHAR2(30) NULL
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('CA', 30, 'SAN DIEGO')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('CA', 40, 'SACRAMENTO')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('FL', 10, 'MIAMI')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('FL', 20, 'ORLANDO')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('NY', 10, 'NEW YORK')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('NY', 20, 'ALBANY')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('CA', 10, 'LOS ANGELES')
INSERT INTO CITIES(STATE_CODE, CITY_CODE, CITY_NAME)
VALUES('CA', 20, 'SAN FRANCISCO')
CREATE OR REPLACE PACKAGE globalPkg AUTHID CURRENT_USER AS
/* The following are T/SQL specific global variables. */
TYPE RCT1 IS REF CURSOR;/*new weak cursor definition*/
END globalPkg;
CREATE OR REPLACE PROCEDURE SP_ADDCITY(
P_STATE_CODE IN VARCHAR,
P_CITY_CODE IN NUMBER,
P_CITY_NAME IN VARCHAR2,
P_RETURN IN OUT NUMBER)
AS
StoO_error INTEGER;
StoO_selcnt INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
BEGIN
StoO_rowcnt := 0;
StoO_error := 0;
StoO_selcnt := 0;
P_RETURN := 0;
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES (P_STATE_CODE, P_CITY_CODE, P_CITY_NAME);
StoO_rowcnt := SQL%ROWCOUNT;
EXCEPTION
WHEN TOO_MANY_ROWS THEN
StoO_rowcnt := 2;
WHEN OTHERS THEN
StoO_rowcnt := 0;
StoO_selcnt := 0;
StoO_error := SQLCODE;
StoO_errmsg := SQLERRM;
IF StoO_error != 0 THEN
BEGIN
P_RETURN := 1;
RETURN;
END;
END IF;
END;
CREATE OR REPLACE PROCEDURE SP_GETCITIES(
STATE_KEY IN VARCHAR,
RC1 IN OUT globalPkg.RCT1)
AS
StoO_error INTEGER;
StoO_selcnt INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
BEGIN
StoO_rowcnt := 0;
StoO_error := 0;
StoO_selcnt := 0;
OPEN RC1 FOR
SELECT STATE_CODE, CITY_CODE, CITY_NAME
FROM CITIES
WHERE STATE_CODE = STATE_KEY
ORDER BY CITY_CODE;
StoO_rowcnt := SQL%ROWCOUNT;
EXCEPTION
WHEN OTHERS THEN
StoO_rowcnt := 0;
StoO_error := SQLCODE;
StoO_errmsg := SQLERRM;
END;
/Hi Mark,
Thanks for your recommendations.
I change the code with OCIDefineByPos, one for each parameter from cursor and then use the OCIStmtFetch.
I don´t receive a error when call OCIDefineByPos, but when I call OCIStmtFetch receive a -1 error number.
What is wrong with the code?
The script is the same.
I need your help!
Best Regards!
Antonio Garcia (Mexico)
This the new code:
#include <stdio.h>
#include <string.h>
#include <oci.h>
#include <stdlib.h>
char* pConnectChar ="ORAC617";
char* pUsernameChar = "C617_005_DBO_01";
char* pPasswordChar = "Tempora1";
char* sqlCharArray1 = "BEGIN SP_GETCITIES(:s, :c); END;";
int retval;
ub4 parmcnt=0;
ub4 pos2=0;
sb2 *c_indp;
text *pcoln[20], *name,*name2;
ub4 namelen[20],len;
ub2 type,size;
char state_key[5];
OCIDefine *pdef;
OCIBind *p_bnd;
ub1 **c_buf;
OCIStmt* pOciStatement; /* Statement handle */
OCIStmt* pOciStatCursor; /* Statement handle */
OCIError* pOciError; /* Error handle */
OCIEnv* pOciEnviron; /* Environment handle */
OCIServer* pOciServer; /* Server handle */
OCISession* pOciSession; /* Session handle */
OCISvcCtx* pOciServiceContext; /* Service Context handle */
OCIBind* pOciBind[500]; /* Bind handle */
OCIParam* pOciParam; /* Param handle */
int OCI_Fetch(OCIStmt *p_select,OCIError *p_err, int *piOcc)
int iOcc, rc;
rc=OCIStmtFetch(p_select,p_err,1,OCI_FETCH_NEXT,OCI_DEFAULT);
printf("rc fetch %i",rc);
if(rc==0&&piOcc!=NULL){
printf("entro al if");
iOcc=*piOcc;
*piOcc=iOcc+1;
return rc;
int main()
int pos,i=0,rc;
retval = OCIEnvCreate(&pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL,0,NULL);
printf("EnvCreate retval=%d\n", retval);
retval = OCIEnvInit(&pOciEnviron, OCI_DEFAULT, 0, NULL);
printf("EnvInit retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
printf("HandleAlloc OCI_HTYPE_ERROR retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
printf("HandleAlloc OCI_HTYPE_SVCCTX retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatement, OCI_HTYPE_STMT, 0, NULL);
printf("HandleAlloc OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCILogon(pOciEnviron,pOciError,&pOciServiceContext,(unsigned char *)pUsernameChar,
strlen(pUsernameChar), (unsigned char *)pPasswordChar, strlen(pPasswordChar),
(unsigned char *)pConnectChar,strlen(pConnectChar));
printf("OCILogon retval=%d\n",retval);
retval = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray1,strlen(sqlCharArray1),
OCI_NTV_SYNTAX, OCI_DEFAULT);
printf("StmtPrepare retval=%d\n",retval);
retval = OCIHandleAlloc(pOciEnviron, (void **)&pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
printf("HandleAlloc OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4) 1, (void *)&state_key,
(sb4) sizeof(state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *)&pOciStatCursor,
(sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *)0,(ub4)0, (ub4 *)0, (ub4) OCI_DEFAULT);
printf("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
strcpy(state_key,"CA");
retval = OCIStmtExecute(pOciServiceContext, pOciStatement, pOciError, (ub4)1, (ub4) 0,
(OCISnapshot *)NULL, (OCISnapshot *)NULL, (ub4) OCI_DEFAULT);
printf("StmtExecute retval=%d\n",retval);
c_buf=(ub1 **)calloc(sizeof(ub1 *),3);
c_indp=(sb2 *)calloc(sizeof(sb2 *),3);
// Get number of parameters of the Cursor
OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &parmcnt,(ub4 *) 0,
(ub4)OCI_ATTR_PARAM_COUNT, pOciError);
printf("\nNumber of parameters of the cursor = %d\n",parmcnt);
for (pos = 1; pos <= (int)parmcnt; pos++)
OCIAttrGet((void *) pOciStatCursor, (ub4)OCI_HTYPE_STMT, (void*) &pos2,(ub4 *) 0,
(ub4)OCI_ATTR_CURRENT_POSITION, pOciError);
retval = OCIParamGet((void *)pOciStatCursor, (ub4)OCI_HTYPE_STMT, pOciError, (void **)&pOciParam,(ub4) pos );
// Get the column name
OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &name,(ub4 *) &len, (ub4) OCI_ATTR_NAME,(OCIError *)pOciError );
// Get the column datatype
OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &type,(ub4 *)0,(ub4)OCI_ATTR_DATA_TYPE,(OCIError *)pOciError);
// Get the column size
OCIAttrGet((void*) pOciParam, (ub4) OCI_DTYPE_PARAM,(void*) &size,(ub4 *)0,(ub4)OCI_ATTR_DATA_SIZE,(OCIError *)pOciError);
printf("Column %i\tNAME = %.*s \ttype %d \tsize %d\n",pos,len,name,type,size);
// OCIDefine ByPos, one for each parameter
// c_buf store the STATE_CODE, CITY_CODE and CITY_NAME columns from the cursor
rc=OCIDefineByPos(pOciStatCursor,&pdef,(OCIError *)pOciError,pos,c_buf[pos-1],size+1,(ub2)type,(dvoid *)c_indp[pos-1],(ub2 *)0,(ub2 *)0,OCI_DEFAULT);
printf("OCIDefineByPos retval=%d\n,rc);
// call OCIStmtFetch. In the next line, I receive the error
rc=OCIStmtFetch(pOciStatCursor,pOciError,1,OCI_FETCH_NEXT,OCI_DEFAULT);
printf("rc fetch %i",rc);
return 0;
{code} -
Problem with accepting the Ref Cursor in c# program
I am passing an argument as OUT Ref Cursor in a stored procedure. and calling the procedure from my c# program.
I can connect the database successfully but am getting the error on calling the procedure.
I am using the ODBC connection
My procedure's signatures are like:
CREATE OR REPLACE PACKAGE BODY packageName
IS
PROCEDURE GetOutput(returnCursor OUT Sys_RefCursor)
AS
BEGIN
OPEN returnCursor FOR
<<my select statement>>
END GetOutput;
END packageName;
My function call is like:
CString Extract::ExtractScript() const
CString script;
script.Format("{Call %s.%s()}", packageName,GetOutput);
return script;
I can compile the procedure successfully on Toad but while calling the procedure from the C# program it gives following error
Connection Successful
Problem executing SQL {Call packageName.GetOutput()}...
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'GetOutput'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Message was edited by:
user653288Hi Aga,
Thanks for your response.
I figured out the problem.
I was using the ODBC connection which wasnt updated for Oracle 10g.
I have updated that. Now its working fine.
Thanks again
Regards -
Call ref cursor functions in function also returning ref cursor?
In 10g database, I have several functions and procedures, some packaged, that return ref cursors. These work as expected.
Is there a way to call one or more of these in a new function and return another ref cursor?
I know this doesn't work, but I hope it conveys the idea.
function f_get_order_lines
return sys_refcursor -- or defined ref cursor
is
v_ords orders_rcr;
v_lines lines_rcr;
x sys_refcursor;
begin
v_ords := f_get_orders;
for rec in v_ords
loop
v_lines := f_get_lines;
... do other work here...
end loop;
return x;
end;Pipelined table functions might do the trick for you, depending you your requirements and the transformations you need to make:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2345 -
VC 7.0 Oracle stored procedures resultset with ref cursor
Can VC (we are on NW7 SP13) handle Oracle's datatype ref cursor - which is the standard solution in Oracle to return result sets - as the return value of a stored procedure?
When testing a data service in the VC story board based upon a simple Oracle function like:
create or replace package pkg_dev
is
type t_cursor is ref cursor;
end;
create or replace function vc_stub return pkg_dev.t_cursor
as
l_cursor pkg_dev.t_cursor;
begin
open l_cursor for select ename from emp;
return l_cursor;
end;
(just as example - I know that could be easily retrieved using the BI JDBC connector framework and accessing tables / views)
I am always running in the "portal request failed ( Could not execute Stored Procedure)" error - so I am not able to use the "add fields" function to bind the output.
The defaulttrace contains entries like:
Text: com.sap.portal.vc.HTMLBRunTime
[EXCEPTION]
com.sapportals.connector.execution.ExecutionException: Could not execute stored procedure
Caused by: java.sql.SQLException: Invalid column type
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
We deployed Oracle's own jdbc-driver for Oracle 10g. Using that driver and a portal jdbc connector framework entry the stored procedures of the Oracle database user mapped to the portal user are discovered and available in the "Find Data Services" section.We deployed the drivers as described in the HowTo Papers (e.g.Hwo to Configure UD Connect on the J2EE Server for JDBC Access to External Databases). When deploying the drivers you assign a freely definable name for the set of Oracle's jar-files (eg. oracle_10) as library name. Having deployed the drivers in that way only System Definitions via BI JDBC connector framework were working. With a little help from SAP Support (call lasted more than 2 months till a very capable member of the support team made things working in a very short time) we got the portal jdbc connection with Oracle's jar-files working:
Here are instructions how to add reference:
1. Connect to the j2ee using telnet, e.g in the cmd window type:
telnet <host> <port> + 8, enter uid and pwd of j2ee admin.
2. jump 0
3. add deploy
4. change_ref -m com.sapportals.connectors.database <your lib name> <your lib name = oracle_10>
Trying to manually add this reference in visual admin connector container for JDBCFactory failed - reference could be added and saved, but then disappeared (at least in NW7 with SP12). Adding the reference as described above solved the problem. -
Creating Web services using JDeveloper for Pl/SQL package having ref cursor
Hi,
I am trying to create web services for PL/SQL package in JDeveloper. When I am trying to create this web service, the functions in the package which is returning referential cursor or record cursor are not visible. When I highlight the function and click "Why Not?", it displays the message "The following types used by the program unit do not have an XML schema mapping and/or serializer Specified: REF CURSOR". Could you please let me know, how I can create this web service?
I am getting similar error when I am trying to create web service for a package with overloaded functions also.
Thanks,Ok so I played around with this some more. I created the same process in bpel using oracle bpel designer and here are the results.
1. Against 10g database running a synch process data is retutned without error.
2. Against 9i database running an asynch process data is retutned without error.
3. Against 9i database running a synch process data is retutned with error.
I'm definilty missing something. -
64bit OraOLEDB failed when calling stored procedure with Ref Cursor
Hi everyone,
I used the ADO VB sample provided with the Oracle 10g provider installation.
But I compiled it in 64bit Visual Studio 2005 and ran on Windows 2003 x64 server.
The function call "cmd.Execute" when it is trying to call a stored procedure which has an Out Ref Cursor parameter. The exception is
"PLS-00306: wrong number or types arguments in call"
I already set the property "PLSQLRSet" to true. But it doesn't help.
The same code works if I compiled in 32 bit.
It also works if the stored procedure does not have Ref Cursor parameter.
I am guessing this is a bug in the 64bit Oracle provider. Anyone can confirm this please? or am I missing anything?
WilsonIt appears to work with 11.1.0.6.20 OLEDB provider but only for ExecuteNonQuery, I'm not able to work with Fill, and yes... in x86 works perfectly, but in x64 we are still having the ORA-06550 and PLS-00306 error.
Our Connection string is as follows:
"Provider=OraOLEDB.Oracle.1;OLEDB.NET=true;Password=xxxxx;Persist Security Info=True;User ID=exxxxx;Data Source=ECOR; PLSQLRSet=True"
We are not using ODP.NET.
Can you confirm that Fill method works with such update? -
Version details
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - ProductionBelow is the procedure where I'm using ref cursor
CREATE OR REPLACE PROCEDURE ref_sample
p_account_nbr in varchar2,
p_ref_out out sys_refcursor
IS
BEGIN
OPEN p_ref_out FOR
SELECT account_nbr,status,(
CASE
WHEN status = 'Pending' THEN
req_mail_date
WHEN status IN ('Rejected','Approved') THEN
NVL(verified_mail_date,req_mail_date)
END
)req_mail_date ,
CASE
WHEN status = 'Pending' THEN
NULL
WHEN status IN ('Rejected','Approved') THEN
NVL(verified_user_id,req_user_id)
END
)req_user_id
FROM X_tbl
WHERE account_nbr IN p_account_nbr
AND TRUNC(upload_date) = TRUNC(SYSDATE)
ORDER BY upload_date DESC ;
END;
/My input parameter p_account_nbr looks like ('a1','a2','a3')
Now,after knowing the importance of bind variables I'd like to make use of them in the above ref cursor.
But,here my input parameter is a string of varying length..either I've to go for the approach suggested here
http://asktom.oracle.com/pls/asktom/f?p=100:11:3667281145899708::::P11_QUESTION_ID:110612348061
or
http://www.dba-oracle.com/t_cursor_sharing.htm
I'm not much clear with the first approach,so I'm thinking of to modify my procedure as below
CREATE OR REPLACE PROCEDURE ref_sample
p_account_nbr in varchar2,
p_ref_out out sys_refcursor
IS
BEGIN
alter session set cursor_sharing=force;
OPEN p_ref_out FOR
SELECT account_nbr,status,(
CASE
WHEN status = 'Pending' THEN
req_mail_date
WHEN status IN ('Rejected','Approved') THEN
NVL(verified_mail_date,req_mail_date)
END
)req_mail_date ,
CASE
WHEN status = 'Pending' THEN
NULL
WHEN status IN ('Rejected','Approved') THEN
NVL(verified_user_id,req_user_id)
END
)req_user_id
FROM X_tbl
WHERE account_nbr IN p_account_nbr
AND TRUNC(upload_date) = TRUNC(SYSDATE)
ORDER BY upload_date DESC ;
alter session set cursor_sharing=exact;
END;
/Please let me know if the above modified code is fine or should I use bind variables??Also let me know better approach of both.The correct way to do this is use an array type for the input values as in this example.
SQL> create or replace procedure p
2 (
3 p_values sys.odcivarchar2list,
4 c out sys_refcursor
5 ) as
6 begin
7 open c for
8 select object_name, owner, object_type
9 from all_objects
10 where object_name in (select column_value from table(p_values));
11 end;
12 /
Procedure created.
SQL> var c refcursor
SQL> exec p (sys.odcivarchar2list('DUAL','USER_VIEWS'), :c)
PL/SQL procedure successfully completed.
SQL> print c
OBJECT_NAME OWNER OBJECT_TYPE
DUAL SYS TABLE
DUAL PUBLIC SYNONYM
USER_VIEWS SYS VIEW
USER_VIEWS PUBLIC SYNONYM
SQL> exec p (sys.odcivarchar2list('DUAL','USER_VIEWS','ALL_OBJECTS','ALL_SOURCE'), :c)
PL/SQL procedure successfully completed.
SQL> print c
OBJECT_NAME OWNER OBJECT_TYPE
DUAL SYS TABLE
DUAL PUBLIC SYNONYM
ALL_OBJECTS SYS VIEW
ALL_OBJECTS PUBLIC SYNONYM
USER_VIEWS SYS VIEW
USER_VIEWS PUBLIC SYNONYM
ALL_SOURCE SYS VIEW
ALL_SOURCE PUBLIC SYNONYM
8 rows selected.
SQL>That and other methods are described here.
http://tkyte.blogspot.com/2006/06/varying-in-lists.html
You would not use dynamic SQL. -
[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, KenMore 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
Maybe you are looking for
-
Type of collection to use?
I get a project Id from the database (oracle), search through webpages which have the same data, and the same projectID, but is in a differenct location. Extract data from the different websites, and insert the collected data into the database under
-
How can i transfer all the music from my old iphone to a new one
my iphone broke. i have a new one and im trying to get all the music from the old one to the new one. i dont wanna delete all the music on the old phone i just wanna like "Copy" it to the new phone but i dont know how thats why im asking for help.
-
New Imac 24" Leopard: migrate from G5(Tiger) How To?
Have a new Imac 24". Want to transfer my files from my Dual 2GHZPowerPC G5 to the intel Imac. Older mac has Photoshop 7 and Adobe Pagemaker 7. I have a new CS, Office 08 as well as Iwork 09 for the new Imac. My question is should I install the new pr
-
Could we create an inbound delivery with reference to purchase requisition?
Dear all, Could we create an inbound delivery with reference to purchase requisition? If yes, how could we customize the system? Kind regards, Adi
-
I recent;y downloaded PS CC. Running on 12 GB, but it doesn't seem to matter if I allocate 10% or 90% of my CPU, Photoshop is sluggish. @@