Calling a storedprocedure returning refcursor of xmltype
Hi,
I'm having issues with stored procedure, returning a refcursor of xmltypes. Most of the examples in the docs(http://docs.oracle.com/html/E10927_01/featXML.htm#i1012109) are always a direct query and I have yet to see one using a stored procedure.
Here's a repro script:
Register an xsd:
BEGIN
dbms_xmlschema.registerschema('http://www.testing.com/person.xsd',
'<?xml version = "1.0" encoding = "utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="first_name" type="xs:string"/>
<xs:element name="last_name" type="xs:string"/>
<xs:element name="gender">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="male"/>
<xs:enumeration value="female"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>',
LOCAL => FALSE, -- local
GENTYPES => FALSE, -- generate object types
GENBEAN => FALSE, -- no java beans
GENTABLES => TRUE, -- generate object tables
FORCE => FALSE,
options => dbms_xmlschema.register_binaryxml,
OWNER => USER );
END;
--create a array of int type
CREATE OR REPLACE
type int_array_type as table of number;
-- Create the table
CREATE TABLE person
ID NUMBER,
xml_document XMLTYPE
xmltype column xml_document STORE AS BINARY XML XMLSCHEMA "http://www.testing.com/person.xsd" element "person";
-- insert some data
INSERT INTO person (ID, xml_document)
VALUES (1, XMLTYPE ('<?xml version="1.0" encoding="utf-8"?>
<person xsi:noNamespaceSchemaLocation="http://www.testing.com/person.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<first_name>John</first_name>
<last_name>Doe</last_name>
<gender>male</gender>
</person>'));
INSERT INTO person (ID, xml_document)
VALUES (2, XMLTYPE ('<?xml version="1.0" encoding="utf-8"?>
<person xsi:noNamespaceSchemaLocation="http://www.testing.com/person.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<first_name>Jane</first_name>
<last_name>Doe</last_name>
<gender>female</gender>
</person>'));
Create the Package
create or replace
package test_pkg as
TYPE refcursor IS REF CURSOR;
type t_id_array is table of number index by binary_integer;
-- user procs
procedure udp_get_personlist (
p_ids IN t_id_array,
p_resultset out refcursor );
end test_pkg;
create or replace
package body test_pkg as
procedure udp_get_personlist (
p_ids IN t_id_array,
p_resultset out refcursor ) IS
v_int_array_type int_array_type := int_array_type();
begin
FOR i IN 1..p_ids.COUNT LOOP
v_int_array_type.extend(1);
v_int_array_type(i) := p_ids(i);
END LOOP;
OPEN p_resultset FOR
SELECT E.XML_DOCUMENT AS "person" FROM person E
WHERE e.ID IN ( SELECT t.COLUMN_VALUE FROM TABLE ( v_int_array_type ) t );
end udp_get_personlist;
end test_pkg;And here is my ODP.NET code
using (var con = new OracleConnection("<your oracle connection>"))
using (var cmd = con.CreateCommand())
cmd.CommandText = "test_pkg.udp_get_personlist";
cmd.CommandType = CommandType.StoredProcedure;
int[] ids = new int[] { 1, 2 };
OracleParameter param1 = cmd.Parameters.Add("p_ids", OracleDbType.Int32);
OracleParameter param2 = cmd.Parameters.Add("p_resultset", OracleDbType.RefCursor, ParameterDirection.Output);
param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
param1.Value = ids;
param1.Size = ids.Length;
param1.ArrayBindSize = new int[] { 4, 4 };
// Setup the ArrayBind Status for param2
param1.ArrayBindStatus = new OracleParameterStatus[1] { OracleParameterStatus.Success }; //, OracleParameterStatus.Success };
try
cmd.XmlQueryProperties.MaxRows = 1;
con.Open();
XmlReader r = cmd.ExecuteXmlReader(); // this always generates invalidoperationexception
// do something with the result
catch (Exception)
throw;
// Close and Dispose OracleConnection object
con.Close();
con.Dispose();
} Server/Tools information:
Oracle is Standard - Oracle Database 11g Release 11.2.0.1.0 running on Windows Server 2003 Std
ODP.NET (ie Oracle.DataAccess.DLL is 4.112.3.0);
Visual Studio 2010 Ultimate SP1
Any pointers in what I'm (obviously doing wrong) is greatly appreciated...
thanks
Edited by: 947266 on Sep 10, 2012 9:46 AM
Was able to make it work
using (var con = new OracleConnection("<your oracle connection>"))
using (var cmd = con.CreateCommand())
cmd.CommandText = "test_pkg.udp_get_personlist";
cmd.CommandType = CommandType.StoredProcedure;
int[] ids = new int[] { 1, 2 };
OracleParameter param1 = cmd.Parameters.Add("p_ids", OracleDbType.Int32);
OracleParameter param2 = cmd.Parameters.Add("p_resultset", OracleDbType.RefCursor, ParameterDirection.Output);
param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
param1.Value = ids;
param1.Size = ids.Length;
param1.ArrayBindSize = new int[] { 4, 4 };
// Setup the ArrayBind Status for param2
param1.ArrayBindStatus = new OracleParameterStatus[1] { OracleParameterStatus.Success }; //, OracleParameterStatus.Success };
try
cmd.XmlQueryProperties.MaxRows = 1;
con.Open();
int i = cmd.ExecuteNonQuery();
OracleRefCursor curs = (OracleRefCursor)cmd.Parameters["p_resultset"].Value;
OracleDataReader dr = curs.GetDataReader();
while (dr.Read())
Console.WriteLine(dr[0].ToString());
catch (Exception)
throw;
// Close and Dispose OracleConnection object
con.Close();
con.Dispose();
}
Similar Messages
-
Error in calling Stored procedure returns REFCURSOR
Hi,
I've written a oracle stored procedure returning REFCURSOR. say,extractorderdespatchconfirmsp('','','','','','H1','ACG','','','','',:rc).
Following statement throwing error.
CallableStatement cs = con.PrepareCall("{extractorderdespatchconfirmsp('','','','','','H1','ACG','','','','',:rc)}");
rs = cs.executeQuery();
Could you rectify this problem and give me the currect code.
riyazYour naming convention leaves a little to be desired.
String command = "{CALL extractorderdespatchconfirmsp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
CallableStatement cstmt = conn.prepareCall(command);
//set the variables here ie, dates need to be a timestamp format. use set timestamp.
cstmt.setInt(1, 2);
cstmt.setString(2, "a string");
cstmt.setInt(3, 0);
//for return values
cstmt.registerOutParameter(3, Types.INTEGER);
cstmt.registerOutParameter(2, Types.INTEGER);
cstmt.execute();
int status = cstmt.getInt(3);
int status2 = cstmt.getInt(2);
cstmt.close();
It took me awhile too to get JDBC to call these right. -
Call to StoredProcedure returning ORA-06550
Please tell me what the following means:-
Warning: ociexecute() [function.ociexecute]: OCIStmtExecute: ORA-06550: line 1, column 7: PLS-00905: object BIG.SPPACKAGE is invalid ORA-06550: line 1, column 7: PL/SQL: Statement ignored in C:\Program Files\Apache Group\Apache2\htdocs\Events\OracleGetClientTest.php on line 44
The code around line 44 looks like:-
$SQL = "begin spPackage.spMemberDetails(:p_number, :p_recordset); end;";
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn, $SQL );
if (!$stmt)
trigger_error(sprintf("Cannot parse query for [%s] ", $number), E_USER_ERROR);
die();
OCIBindByName($stmt,":p_number",&$number,15);
OCIBindByName($stmt,":p_recordset",&$curs,10,OCI_B_CURSOR);
$exec = OCIExecute($stmt);
and OCIExecute is Line 44.I reran as follows and now get:-
SQL> @c:\temp\sppackage-Gerhard.sql;
Package created.
No errors.
Warning: Package Body created with compilation errors.
SQL> select * from all_objects where object_name = 'SPPACKAGE';
OWNER OBJECT_NAME
SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
CREATED LAST_DDL_ TIMESTAMP STATUS T G S
BIG SPPACKAGE
13676 PACKAGE
17/MAY/07 18/MAY/07 2007-05-18:13:26:16 VALID N N N
BIG SPPACKAGE
13686 PACKAGE BODY
18/MAY/07 18/MAY/07 2007-05-18:13:34:15 INVALID N N N
OWNER OBJECT_NAME
SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
CREATED LAST_DDL_ TIMESTAMP STATUS T G S
Now its only the body that is invalid, but why? -
Memory Leak when I get the SP return refcursor by oracle ODBC driver:
Oracle server:HP-Unix
Oracle Version: 9.2.0.6.0
Application Server: windows2003
Develop tool : VC++;
Question:
when I get the return refcursor by OLEDB.Oracle, there is not any memory leak and work well. But when I change the driver to ODBC Oralce in OraHome92"
there will be an 56k memory leak.
And in the other hand if I call an store precedure without return ref. Both driver /way can work well.
Can you give me the advice? thanks a lot.
Code such as:
_ConnectionPtr m_AdoConnection;
_CommandPtr pcmd = NULL;
_RecordsetPtr sp_rs = NULL;
_bstr_t bstrConstruct = _bstr_t("DSN=test;Uid=test;Pwd=test;PLSQLRSet=1");
HRESULT hr = CoCreateInstance(__uuidof(Connection),NULL,CLSCTX_INPROC_SERVER,__uuidof(_ConnectionPtr),(LPVOID *)&m_AdoConnection);
if (FAILED (hr) ) throw hr ;
m_AdoConnection->PutCursorLocation(adUseClient) ;
m_AdoConnection->IsolationLevel = adXactSerializable;
m_AdoConnection->Mode = adModeShareExclusive;
bstr_t bstrEmpty(L"") ;
m_AdoConnection->Open (bstrConstruct, bstrEmpty, bstrEmpty, -1) ;
SAFE_CALL(m_spObjectContext->CreateInstance(__uuidof(Command),__uuidof(_CommandPtr),(LPVOID *)&pcmd));
if(pcmd == NULL)
throw CAtlExceptionEx(E_POINTER,"pcmd is NULL");
pcmd->CommandText = _bstr_t(L"wec_pkg_spl.wec_proc_spl_check");
pcmd->CommandType = adCmdStoredProc;
_bstr_t id = _bstr_t("65650000");
pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"id"),DataTypeEnum(adVarChar),adParamInput,2000,_variant_t(id)));
pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"errcode"),DataTypeEnum(adNumeric),adParamOutput,4));
pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"errdescription"),DataTypeEnum(adVarChar),adParamOutput,2000));
pcmd->ActiveConnection = sp_con.m_AdoConnection;
sp_rs = pcmd->Execute(NULL,NULL,adCmdStoredProc);
pcmd->Release;
sp_rs->Close();
if (m_AdoConnection->State == adStateOpen)
m_AdoConnection->Close();
wec_pkg_spl.wec_proc_spl_check arguments:
id varchar2 in
flowpaths ref cursor out
errcode number out
errdescription varchar2 out
Message was edited by:
[email protected]I'm using the oracle ODBC driver 8.05.10 with MFC and client version 8.0.5. In my experience you can't prevent memory leaks with that or earlier versions of the ODBC driver. Client patchkits or service packs for NT or the Visual Studio doesn't solve the problem.
The following code will result in a memory leak with the oracle driver. With every expiration of the timer the leak will grow.
void CTestOdbcOracleDriverDlg::OnTimer(UINT nIDEvent)
TCHAR errString[255];
//open the database with class CDatabase
//use of CRecordset
TRY {
//my table name is AL_ALARME_LOG
pMyRecordset->Open(CRecordset::dynaset,"SELECT * FROM AL_ALARME_LOG",CRecordset::none);
//do something with the data
Sleep(0);
pMyRecordset->Close();
CATCH_ALL(error) {
error->GetErrorMessage(errString,255);
DELETE_EXCEPTION(error);
END_CATCH_ALL
CDialog::OnTimer(nIDEvent);
The same code with the Microsoft ODBC driver
doesn't cause memory leaks.
Andreas ([email protected]) -
Calling a procedure (with refcursor) from another procedure
I have a procedure that returns refcursor (it's used by a Java application).
I am able to run the proc via SQLPlus like below:
var a refcursor;
exec MY_PKG.get_content_prc(:a);
print a;
I would like to use/call this proc from another procedure and I am not able to, since arg is refcursor.
create or replace procedure p
is
v refcursor;
begin
MY_PKG.get_content_prc(:v);
end;
Error I get is:
SQL> show err
Errors for PROCEDURE P2:
LINE/COL ERROR
4/3 PL/SQL: Item ignored
4/7 PLS-00201: identifier 'CURSOR' must be declared
6/5 PL/SQL: Statement ignored
6/57 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
Hope someone can direct me.
RegardsBecause you are not using the right syntax.
You need to do something like this
LOOP
/* Fetch from cursor variable. */
FETCH emp_cv INTO emp_rec;
EXIT WHEN emp_cv%NOTFOUND; -- exit when last row is fetched
-- process data record
END LOOP;This is from the PL/SQL User's Guide and Reference.
I would recommend reading this fine manual, it is faster than guessing. -
Call a storedprocedure with CLOB input parameter gives ORA-24811 error
Hi all,
I am calling a storedprocedure from VB using ADO and OraOLEDB. Calling stored procedure as mention in OraOLED documentation.
The procedure accepts a varchar and a CLOB parameter.
While executing the store procedure its throw an error as Error while trying to retrieve text for error ORA-24811
Then I executed a storeprocedure with only one CLOB out parameter. It is working fine.
Oracle version is
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
PL/SQL Release 9.2.0.4.0 - Production
CORE 9.2.0.3.0 Production
TNS for Linux IA64: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production
O/S: Linux.
OLEDB version 9.0.1.0.1
But exact code working with
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 Production
O/S window 2003
OLEDB version 9.0.1.0.1
Can somebody help me on this?
Regards,
Mani
Sample code of stored of stored procedure and VB function pasted below.
StoreProcedure
============
create or replace procedure xmltext (EmpName varchar2,EmpDetails CLOB)
as
begin
insert into emptmp values (EmpName);
end;
VB function
=========
Dim Oracon As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim param1 As New ADODB.Parameter
Dim param2 As New ADODB.Parameter
Dim empname As String
Dim empdetails As String
Set Oracon = CreateObject("ADODB.Connection")
Oracon.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=testdb;User ID=newtest;Password= newtest;PLSQLRSet=1;SPPrmsLOB=1"
Oracon.Open
empname = "Mani"
empdetails = "<EmpDet/>"
Set cmd.ActiveConnection = Oracon
cmd.CommandType = adCmdText
Set param1 = cmd.CreateParameter("param1", adVarChar, adParamOutput, 10, empname)
cmd.Parameters.Append param1
Set param2 = cmd.CreateParameter("param2", adLongVarChar, adParamInput, 10000, empdetails)
cmd.Parameters.Append param2
cmd.CommandText = "{ call xmlText(?,?)}"
cmd.Executecode for my procedure testblob is :
create or replace procedure testblob(bpic blob) as
val blob;
v_rdata blob;
v_start BINARY_INTEGER := 1;
v_buffer BINARY_INTEGER := 32767;
BEGIN
select pic into val from my_pic where no=1 for update;
DBMS_LOB.OPEN (val, DBMS_LOB.LOB_READWRITE);
FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(bpic) / v_buffer)
LOOP
v_rdata :=DBMS_LOB.SUBSTR(bpic, v_buffer, v_start) ;
DBMS_LOB.WRITEAPPEND(val, DBMS_LOB.GETLENGTH(v_rdata), v_rdata);
v_start := v_start + v_buffer;
END LOOP;
dbms_lob.close(val);
exception
when others then
raise_application_error(-20000,sqlerrm);
end; -
Calling task flows return activity from Jspx page.
Hi ,
Using JDev11.1.1.6
I have created template for home page, drag and dropped the task flow(Main Task flow) as region.
Main task flow contains other 2 taskflows with control flows and other 2 taskflows contains Task flow return activity to navigate back to Main task flow.
I need to call task flow return activity from jspx page.
How it can be acheived? can you please suggest me.
Thanks and Regards,
Raj Gopal KHi,
My use case is to close the child task flow and navigate back to main task flow. This should be done through homePage.jspx(whch contains main task flow).
What i have done:
Having page template which has logout and home page links. Use this template to create homePage.jspx, Next drag the main task flow to create a region inside the homePage.jspx.
Thanks,
Rajgopal K -
Tidal abends with error message: Jvm call Runtime.exec() returned null
just wandering if this error "Jvm call Runtime.exec() returned null Command[chmod 777] launch failed." is a tidal error and not a job command error returned from the OS server.
thanks,
warrenI'm having the same problem...
Have you been able to solve your problem yet? -
J2me Mobile client calling method which return byte[]
java.rmi.MarshalException: Expected Byte, received: SGVsbG8gV29ybGQ=
WebService1_Stub ws=new WebService1_Stub();
try {
String s=ws.getStringHelloWorld();// works fine
byte s[]=ws.helloWorld(); // error java.rmi.MarshalException: Expected Byte, received: SGVsbG8gV29ybGQ=
}catch(Expception e){
ex.printStackTrace();
}This same ws working fine in java standalone application please guide me what can be a problem ??
Regards
Haroon Idreesclear your app. server logs ( or make copies of them if will you need them) and redo the whole process. check out the logs and you should see some reason for this. i do not know if Borland's logs will turn out helpful, but it did help me out in certain other situations.
-
How to call a procedure with refcursor from another plsql unit
example I created a pkg with the a procedure that returns a REFCURSOR.
Now I need to call this procedure from another pkg and use the refcursor values in other pkg.
Help please.......
PROCEDURE CustomerSite_Get (p_Registry IN VARCHAR2,
p_CustomerNumber IN VARCHAR2, p_Cursor IN OUT t_cursor);
PROCEDURE CustomerSite_Get (p_Registry IN VARCHAR2,
p_CustomerNumber IN VARCHAR2, p_Cursor IN OUT t_cursor)
IS
-- 0903: Include BillToName
BEGIN
OPEN p_Cursor FOR
SELECT S.LOCATION CustomerSite, S.SITE_USE_ID CustomerSiteID, C.CUSTOMER_NAME BillToName
FROM RA_CUSTOMERS C,
RA_ADDRESSES A,
RA_SITE_USES S,
UWA_REGISTRY R,
UWA_REGISTRY_BILL_TO B
WHERE C.CUSTOMER_ID = A.CUSTOMER_ID
AND A.ADDRESS_ID = S.ADDRESS_ID
AND S.SITE_USE_ID = B.SITE_USE_ID
AND R.REGISTRY_ID = B.REGISTRY_ID
AND B.TRIP_BILLING != 'N'
AND R.DELETE_FLAG != 'Y'
AND R.Registry = p_Registry
AND R.CUSTOMER_NUM = p_CustomerNumber
ORDER BY S.LOCATION;
END CustomerSite_Get;
thanks,
Anitha.
Edited by: user521218 on May 6, 2009 1:24 PMHi Anitha,
try this,
-- PKG_A
Procedure CustomerSite_Get( p_Registry IN Varchar2
, p_CustomerNumber IN Varchar2
, p_Cursor IN OUT t_cursor) Is
Begin
PKG_B.CustomerSite_Get( p_Registry
, p_CustomerNumber
, p_Cursor );
End;
-- PKG_B
Procedure CustomerSite_Get(p_Registry IN Varchar2
,p_CustomerNumber IN Varchar2
,p_Cursor IN OUT t_cursor) Is
Begin
Open p_Cursor For
SELECT S.LOCATION CustomerSite
,S.SITE_USE_ID CustomerSiteID
,C.CUSTOMER_NAME BillToName
FROM RA_CUSTOMERS C
,RA_ADDRESSES A
,RA_SITE_USES S
,UWA_REGISTRY R
,UWA_REGISTRY_BILL_TO B
WHERE C.CUSTOMER_ID = A.CUSTOMER_ID
AND A.ADDRESS_ID = S.ADDRESS_ID
AND S.SITE_USE_ID = B.SITE_USE_ID
AND R.REGISTRY_ID = B.REGISTRY_ID
AND B.TRIP_BILLING != 'N'
AND R.DELETE_FLAG != 'Y'
AND R.Registry = p_Registry
AND R.CUSTOMER_NUM = p_CustomerNumber
Order BY S.LOCATION;
End CustomerSite_Get;regards,
Christian Balz -
Calling a stored procedure with an XmlType parameter.
I am attempting to execute a stored function via a named query. The stored procedure has a single parameter of Oracles 'xmltype', and also returns an xmltype. For example this dummy function
function testXML(xml_in xmltype) return xmltype is
begin
return xml_in;
end;
Is it possible to make the named query call with an oracle.xdb.XMLType or oracle.xdb.dom.XDBDocument? I cannot find any examples of this being done. I also want the returning xmltype to be converted into a Java class.
Another question - will I need to work with a conversion manager to achieve this?Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Invalid column typeError Code: 17004
Call:BEGIN ? := TestPackage.testXML(XML_IN=>?); END;
bind => [=> RESULT, oracle.xml.parser.v2.XMLDocument@1a64732 => XML_IN]
Query:DataReadQuery()
at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:290)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:570)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:442)
at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:453)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:117)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:103)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:174)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:156)
at oracle.toplink.queryframework.DataReadQuery.executeNonCursor(DataReadQuery.java:118)
at oracle.toplink.queryframework.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:110)
at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:603) -
Problem calling Stored Procedure returning SETOF UDT (Using Spring)
I am using Spring's StoredProcedure class to call a stored procedure from a PostgreSql database. It returns a set of user defined data types. I'm having a problem in parsing the results returned.
The user defined data type :
CREATE TYPE process_states AS (
process_name text,
process_type text
The stored procedure returns a SET of "process_state" :
CREATE FUNTION inquire_process_state (.....)
RETURNS SETOF process_state AS '
SELECT ....
I hava a Java class extending the Spring StoredProcedure classs.
public MyProcStats extends StoredProcedure {
private class ProcStateCallBackHandler implements RowCallBackHandler {
public void processRow(ResultSet rs) throws SQLException {
System.out.println(rs.getString(1));
public MyProcStats (DataSource ds) {
super(ds, "inquire_process_state");
super.setFunction(true);
declareParameter(new SqlOutparameter("rs", Types.OTHER, new ProcStateCallBackHandler());
declareParameter(new SqlParameter("family_name", Types.VARCHAR) ;
While testing this class, I get an errormessage
"java.sql.SQLException:ERROR: cannot display a value of type record"
I would appreciate if anyone can point out my mistakes. I tried declaring
new SqlOutParameter("rs", Types.OTHER, "process_state"), but that didn't help.As the related posts suggest, you will need to use direct JDBC code for this.
Also I'm not sure JDBC supports the RECORD type, so you may need to wrap your stored functions with ones that either flatten the record out, or take OBJECT types. -
CALLING ORACLE STOREDPROCEDURES FROM JAVA
Hi friends
can anyone tell me how to use storedprocedures of Oracle with swings...
THANX IN ANTICIPATION
aLEXPlease check the following code:
CallableStatement cstmt = conn.prepareCall("{ ? = call inc_trace()}");
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.executeUpdate();
trace = cstmt.getInt(1);
Attention:
(1) you must use registerOutParameter() to set the return message;
(2) and, your must use setXXX methods to set parameters.
Hope this help!
Jack -
OfficeJet Pro 8600 plus will not install , msg Call to DriverPackageInstall returns error 5
I get message "Call to Driver Package Install returned error 5 for package -c\Program Files\HP\HP OfficeJet Pro 8600\Drivers Store\Pipeline\hpup\03.inf-Call to Driver Package Install must be a member of th eadministrator group to install a driver package. Laptop is HP, Core 5, running Win 8.1
No security messages arose during very slow install.
Tried several times, tried to download installation package as suggested btroubleshooter but aborted 4 times (4 hours), other downloads had no problem. Tried changing startup as indicated also, did not correct the problem.Hi Liam,
The installation CD that came with your 8600 will definitely not work with Windows 8.1 and is not same as the latest online download which you will need to install on Win8.1.
Are you running Win8.1 Pro 32 or 64 bit?
Also make sure you select the right model of your Officejet. There are 3 different models.
HP Officejet Pro 8600 Plus e-All-in-One Printer series - N911
HP Officejet Pro 8600 Plus e-All-in-One Printer - N911g
HP Officejet Pro 8600 e-All-in-One Printer series - N911
HP Officejet Pro 8600 e-All-in-One Printer - N911a
HP Officejet Pro 8600 Premium e-All-in-One Printer series - N911
HP Officejet Pro 8600 Premium e-All-in-One - N911n
Try uninstalling printer from the control panel and reinstall using the Win8.1 download from the link above.
Thanks -
How can I refresh a calling page on return from a TF activity ?
Hi,
I have a (sounds easy) case where a view activity invokes a BTW with fragments. The called BTF has been declared with isolated data control scope. Inside the BTF some updates happen and when the BTF returns the calling view should display the modified data. The BTF should not be opened as a dialog and the above take place inside a region. There are examples in the Internet for how to implement such case but only calling a taskflow with pages from a dialog.
I tried creating first the Taskflow binding definition [19.10.1 How to Associate a Page Definition File with a Task Flow Activity|http://docs.oracle.com/cd/E35521_01/web.111230/e16182/taskflows_activities.htm#sthref539] , then I set the related operations (Execute, setCurrentRowWithKey, ...) in the Page Definition and invoke the operations inside the “After Listener” Listener (<after-listener>) of the taskflow activity but the binding context is not accessible inside the listener, I get NPE accessing the binding.
After some tests I have found that I can call the Operations using “#data.taskflowdefinition..” but I afraid using this technique because of so many papers stating that this is a bad practice.
Additionally I tested using an invokeAction in the calling page definition page and it works but I prefer “refreshing” the model from the activity (there are many pages calling the same activity).
I am wondering if there is a more elegant solution that I haven’t seen yet.
Thanks for any ideas,
Yiannis
Edited by: Tses on Mar 8, 2013 11:15 PMHi Timo and thank you for your reply,
As far as I know any method executed in the BTF has no effect in the calling page because of the isolated data control scope.
Consider the following layout of a very simple TF diagram. The BTF has "Share data controls with calling task flow" unchecked and "Always begin new transaction"
View --> Method Call --> BTF
Now imagine that a user navigates from the View to the BTF, make updates and finally commits the transaction from a taskflow return activity. The updates are executed inside the "private" BTF's data control scope because of the BTF settings.
Returning to the calling View the user sees stale data from the Data Control of the View, until he re-queries the model.
ADF supports execution of code during the call of the BTF (through Method Call) and also sending and returning parameters from the View to the BTF.
Conversely on return from the BTF there is no handler for executing code (something like "Return Method Call") in order to refresh (e.g. re-query and set current row) the View exploiting the return parameters.
The "After Listener" in the taskflow call activity has not access to the bindings context. Using #{data.bindingTFXXX} I guess that has a risk in a high availability environment for NPE where the http call to the BTF might be processed in a different server than the returning http call so the #{data.bindingTFXXX} might not exists.
The other solution I found using invokeAction with RefreshCondition depends on the returning values of the BTF, bloats the View with Bindings that I would prefer to be in a central place.
Am i missing something in the whole flow above ?
Yiannis
Maybe you are looking for
-
Successful update on a 3G--here's what I did
I read a lot of threads here before deciding to take the plunge to update my 3G to OS4. I was able to update successfully thanks to the things I learned here, so I thought my experience might be helpful to someone else. Here's what I did: 1. Installe
-
When I'm creating a new All-Day Event, it immediately disappears if I'm in month view, but shows up in week or day view. This has never ever happened before... If it helps, I'm noticing that it's happening in events that I'm scheduling in April... WH
-
Message type for generating IDOC for SUBCONTRACTING PURCHASE ORDER
Hi All, I have to generate IDOC for PO creation or change . I am using IDOC_OUTPUT_ORDERS and IDOC_OUTPUT_ORDCHG. The messagetype.idoctype I am using is ORDERS. ORDERS05 and ORDCHG. ORDERS05. Now the confusion is regarding whether this message ty
-
How will the ipad batery and screen like this ???
hi! i plan on using my ipad in the dental surgery i am working in to stand most of the time on a dock. while standing on a dock i want it to run movies or slideshows with special offers, before after pictures etc and then i want to take it off the do
-
Affine transformation in creation of S-box(AES)
hi, I am trying to implemeant a toy version of AES. I am working on bits(instead of bytes) of 64. I am unable to do affine transformation on