Scripted JDBC and Oracle Stored Procedure with in/out Array
The com.waveset.util.pooledconnection used by Scripted JDBC Adapter extends java.sql.connection.
I need to pass an Varchar2 Array to the Stored Procedure. I tried using the oracle.sql.ARRAY and oracle.sql.ArrayDescriptor to pass the values, but get a casting exception,as the polledconnection implements only the java.sql.connection and not oracle.sql.connection.
What are my options of using java.sql.Array with a PL/SQL procedure that takes a varchar2 array as in out parameter?
Thanks
Venki
i ran my procedure which is very similar syndra posted
create or replace procedure foo(p_dt in date, cv out sys_refcursor) as
begin
open cv for
select e.*
from table_xyz e
where start_dt = p_dt;
end;
/Here is how is executed
DECLARE
P_DT DATE;
CV SYS_REFCURSOR;
BEGIN
P_DT := '10-oct-2005';
-- CV := NULL; Modify the code to initialize this parameter
scott.foo ( P_DT, CV );
COMMIT;
END;
-- i get PL/SQL procedure successfully complted , But i dont see the result set Or output
- How do i see the output when i m using refcursor ?? i tried using print , but nothing didnt work
- Any idea ??
Thank you!!
Edited by: user642297 on Jun 24, 2010 1:35 PM
Similar Messages
-
Call a UNIX shell script from an oracle stored procedure
We need to call a UNIX shell script from an oracle stored procedure
i.e. the control should come back to the procedure once the script completes. Can any body help to achieve this ?There are various ways in achieving this.
For Example, you can call a PRO*C-Library residing on the database server.
This requires a PL/SQL library to be generated and some changes to the Listener configuration.
It is also possible to implement a java procedure on the database being invoked by a PL/SQL wrapper class.
In this way (and if used right) there is also granularity regarding the filestructure permissions given and it may be called during a Forms or other PL/SQL session.
The article below explains a more generic approach how to invoke shell commands from within an Oracle Instance.
Be careful with this, because it really works ;)
Refer to :
http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
Message was edited by:
user434854 -
Oracle Stored Procedure with out parameter
Good morning,
Is it possible to use an Oracle stored procedure with out parameters in MII ?
If yes, what is the manipulation to see the values of parameters Out?
Thank youMichael,
This is the MII query template :
DECLARE
STRCOMPTERENDU NVARCHAR2(200);
BEGIN
STRCOMPTERENDU := NULL;
XMII.SP_VALIDATEPROCESSORDERSLIST2 ( STRCOMPTERENDU => [Param.1] );
COMMIT;
END;
and the stocked procedure code
CREATE OR REPLACE PROCEDURE XMII.SP_ValidateProcessOrdersList2(strCompteRendu OUT nVarchar2) IS
tmpVar NUMBER;
debugmode INT;
strClauseSql varchar(2048);
strListPOactif varchar(1024);
dtmTimeStamp DATE;
NAME: SP_ValidateProcessOrdersList
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 18/06/2008 1. Created this procedure.
NOTES:
Automatically available Auto Replace Keywords:
Object Name: SP_ValidateProcessOrdersList
Sysdate: 18/06/2008
Date and Time: 18/06/2008, 18:45:32, and 18/06/2008 18:45:32
Username: (set in TOAD Options, Procedure Editor)
Table Name: (set in the "New PL/SQL Object" dialog)
BEGIN
tmpVar := 0;
debugmode := 0;
-- lecture date systeme pour time stamp
select sysdate into dtmTimeStamp from dual;
if debugmode = 1 then
DBMS_OUTPUT.put_line('SP_ValidateProcessOrdersList');
end if;
-- insertion du bloc dans le log
insert into LOG_ORDER
(DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
values
(dtmTimeStamp,'SP_ValidateProcessOrdersList',ID_LOG_ORDER.nextval);
Commit;
if debugmode = 1 then
DBMS_OUTPUT.put_line('insertion LOG OK');
end if;
strCompteRendu := '0123456-896;0123456-897';
commit;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
ROLLBACK;
-- insertion du bloc dans le log
insert into LOG_ORDER
(DATE_ORDER,BLOCK_ORDER,ID_LOG_ORDER)
values
(dtmTimeStamp,' ',ID_LOG_ORDER.nextval);
COMMIT;
-- Consider logging the error and then re-raise
RAISE;
END SP_ValidateProcessOrdersList2;
Thanks for your help
Alexandre -
Calling Oracle Stored procedure with OUT parameter from ODI
Hi,
I called an oracle stored procedure with following anonymous block in the ODI procedure.
Declare
Status varchar2(10);
Begin
OTM.DeleteTarget('E_KPI_TARGET_VALUE', Status);
End;
I want to capture the OUT parameter STATUS value in a project level variable.
And based on its va;lue I would like to choose between 2 interfaces in my package.
Please help me in doing this.Hi,
For that kind of situation I commoly use:
1) one step with:
create or replace package <%=odiRef.getSchemaName("W")%>.pck_var
Status varchar2(10);
end;
* transaction 9, for instance
2) step
Begin
OTM.DeleteTarget('E_KPI_TARGET_VALUE', <%=odiRef.getSchemaName("W")%>.pck_var.Status);
End;
* transaction 9
3) then, at an ODI variable, use a refresh like:
select <%=odiRef.getSchemaName("W")%>.pck_var.Status from dual
at same logical shema where the package was created.
Does it make sense to you? -
Dynamic SQL and Oracle stored procedures
Does anybody has any experience with invoking an Oracle stored procedures
with output parameters, using dynamic SQL from Forte?
Thanks,
DimitarI would be interested. We are currently using a homegrown DataMapper architecture with the Microsoft OracleClient. I would like to move to ODP.Net once a production version supporting ADO.Net 2.0 is available. After that, I would then like to look at using an off the shelf persistence framework such as EntitySpaces, NHibernate or IdeaBlade's DevForce.
-
Toplink support for stored procedure with 2 OUT REF CURSOR ?
Can Toplink StoredProcedureCall be used with Oracle PLSql procedure with 2 OUT parameters. Parameter type is Ref Cursor (Oracle PLSQL resulset)
RegardsIn a TopLink StoredProcedureCall using an OUT CURSOR the cursor is assumed to map to the result set for the TopLink query.
For example if you had a stored procedure READ_ALL_EMP that returned a out cursor of EMP rows, you could use that procedure in a TopLink mapped Employee class mapped to the EMP table and use the stored procedure in a ReadAllQuery for the Employee class.
If the procedure does not return data that maps to objects, you can use a DataReadQuery to access the data. The out cursor would be returned as a Vector of DatabaseRows that contain the data from the cursor rows.
If the procedures data is complex and does not map to objects, it may be better to access the procedure directly through JDBC. -
JDBC Thin-Driver and Oracle Stored Procedure
I've got a Oracle stored procedure which returns a Oracle record.
How can I retrieve the record in java using the JDBC Thin-Driver ?
Record:
TYPE messagerec IS RECORD
(log_level VARCHAR(2), timestamp VARCHAR2(19), text VARCHAR2(200));Using PL/SQL BOOLEAN, RECORD Types, and TABLE Types:
Oracle SQLJ and JDBC do not support calling arguments or return values of the
PL/SQL BOOLEAN type or RECORD types. Also, when using the Thin driver, they
do not support calling arguments or return values of PL/SQL TABLE types (known
as indexed-by tables). TABLE types are supported for the OCI driver.
Check the following guide,
http://otn.oracle.com/tech/java/sqlj_jdbc/pdf/a96655.pdf -
With JDBC, calling a stored procedure with ARRAY as out parameter
Hi,
I want to use the data type ARRAY as an out parameter in an Oracle stored procedure. I want to call the stored procedure from
my java program using JDBC.
The problem it's i use a 8.1.7 client to acces with oci to a 7.1.3 Database.
With this configuration I can get back a Cursor but not an Array.
Does it's possible ?
Thanks for your help !
MichaklOriginally posted by JDBC Development Team:
It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
cstmt.execute ();
ARRAY array = (ARRAY) cstmt.getObject (idx);
Thanks for your reply.
I have to use:-
OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
( "{call proj_array(?)}" ) ;
for retrieving a collection as an OUT parameter.
This gives me the errors:-
C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
import java.sql.*;
^
C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
import java.sql.*;
^
C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
import java.sql.*;
^
C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
import java.sql.*;
^
How do I get rid of these errors?
null -
How to call oracle stored procedure with OUT parameter?
I create oracle stored procedure in eclipse oepe
PROCEDURE SP_SELECT_ORA (
ID_INPUT IN VARCHAR2,
ID_OUTPUT OUT VARCHAR2,
PASSWD_OUTPUT OUT VARCHAR2,
NAME_OUTPUT OUT VARCHAR2) IS
BEGIN
SELECT EMP_ID, EMP_Passwd, EMP_Name
INTO ID_OUTPUT, PASSWD_OUTPUT, NAME_OUTPUT
FROM family
WHERE EMP_ID = ID_INPUT;
END;
and I try to call the sp in jpa like below,
@NamedNativeQueries({
@NamedNativeQuery(name = "callSelectSP", query = "call SP_SELECT_ORA(?,?,?,?)", resultClass = Members.class)
@Entity
@Table(name="family")
public class Members implements Serializable {
@Id
@Column(name = "EMP_ID")
private String ID;
@Column(name = "EMP_Passwd")
private String Passwd;
@Column(name = "EMP_Name")
private String Name;
==============
@PersistenceContext(unitName="MyFamily")
EntityManager em;
query = em.createNamedQuery("callSelectSP");
query.setParameter(1, ID);
String id_output = null;
String passwd_output = null;
String name_output = null;
query.setParameter(2,id_output);
query.setParameter(3,passwd_output);
query.setParameter(4,name_output);
query.executeUpdate();
member = (Members)query.getSingleResult();
But this query throws exception,
19:55:35,500 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) SQL Error: 1465, SQLState: 72000
19:55:35,500 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) ORA-01465: invalid hex number
I don't know how. Pls, give me your advice. Thanks in advnace.
Best regardsThank you for your reply, Chris!
I tried this one.
@NamedNativeQueries({
@NamedNativeQuery(name = "callSelectSP", query = "exec SP_SELECT_ORA( ?, :id_output, :passwd_output, :name_output) " , resultClass = Members.class)
@Entity
@Table(name="family")
public class Members implements Serializable
===================
query = em.createNamedQuery("callSelectSP");
query.setParameter(1, ID);
String id_output = null;
String passwd_output = null;
String name_output = null;
query.setParameter("id_output", id_output);
query.setParameter("passwd_output", passwd_output);
query.setParameter("name_output",name_output);
query.executeUpdate();
On Console hibernate shew the sql and ora # like below,
19:59:25,160 INFO [stdout] (http--127.0.0.1-8080-1) Hibernate: exec SP_SELECT_ORA( ?, ?, ?, ?)
19:59:25,192 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) SQL Error: 900, SQLState: 42000
19:59:25,192 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http--127.0.0.1-8080-1) ORA-00900: Invalid SQL statement
Pls, inform me your advice. Thanks in advance.
Best regards. -
JDBC Sender - Oracle Stored procedures
hi all
i am working on JDBC sender - File receiver
I am fetching data from Oracle database
if i write select query directly in sender adapter the scenario is working properly but when try to write stored procedure in oracle and use execute statement in JDBC, adapter is throwing error.
As in oracle to fetch multiple rows i have to use cursors .
i read lot of articles in forum but still not clear on following issues :can any one solve them?
1 . To get multiple rows can i write SP without cursors?
2 . If SP is using cursor do my XI accept it or it only accepts resultset? in that case how to write sp.
thanks & regards
sheetalSheetal,
Adding to Jai Shankar's reply, Like pointed out, Oracle Stored Procedures return Cursors and XI sender JDBC adapter expects resultsets and so it is not possible to call Oracle SP's from Sender JDBC adapters.
But, I have also come across a few recent threads where there have been discussions that this is possible from SP 16 onwards. I have not been able to check and confirm on this, but, maybe you can check your SP level and see if you are below SP 16 . If yes, definetly not possible. If SP 16, or above, a Quick OSS to SAP should surely give the answer if it is possible or not!
Do let us know your findings.
Regards
Bhavesh -
Reporting off oracle stored procedure with parameters error
Erorr message: Error in File xxx.rpt: Failed to retrieve data from the database. Details: [Database Vendor Code: 907 ]
Asp.net 2.0 web application.
CR XI R2 sp2 in BOE XI R2 sp2 on Solaris 10.
Database: Oracle 10g on Solaris 10. Oracle stored procedure defined in package.
Happens with reports reporting off stored procedure with parameters.
The sp is used in the crystal report.
The web application passes parameters to crystal report, which then passes the parameters to stored procedure.
Encountered error if:
r.PromptOnDemandViewing = false;
r.UseOriginalDataSource = false;
r.CustomServerType = CeReportServerType.ceServerTypeOracle;
Report can retrieves data if:
r.PromptOnDemandViewing = false;
r.UseOriginalDataSource = true;
r.CustomServerType = CeReportServerType.ceServerTypeOracle;
In addition
The steps are:
1) Create oracle package and stored proc.
2) In CR Designer, select the stored proc as datasource.
3) The parameters names were "generated" by the CR Designer.
4) Rename the parameter names.
5) Drag the fields onto report.
We noticed the following with different setting of database logon info:
When previewing from BOE, get error when "Use custom database logon information specified here"
However, no error when "Use original database logon information from the report".
Am i missing something?Please re-post if this is still an issue to the Data Connectivity - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly
-
Getting error while Calling Oracle Stored Procedure with output Parameter
HI All,
From long days i am working on this but i unable to solve it.
Even i have studied so many forums in SAP but i didn't find the solution.
I am calling Oracle Store procedure with 3 inputs and 1 output without cursor.
Store Procedure:-
CREATE OR REPLACE PROCEDURE PDS.send_rm
IS
proc_name VARCHAR2(64) := 'send_rm';
destination_system VARCHAR2(32) := 'RAWMAT';
xml_message VARCHAR2(4000);
status_code INTEGER;
status_message VARCHAR2(128);
debug_message VARCHAR2(128);
p_ret INTEGER;
BEGIN
DBMS_OUTPUT.PUT_LINE( proc_name || ' started' );
xml_message := '<RAW_MATERIAL>'||
'<BAR_CODE>10000764601</BAR_CODE>'||
'<MATERIAL>1101448</MATERIAL>'||
'<VENDOR_CODE/>'||
'<PRODUCTION_DATE>0000-00-00</PRODUCTION_DATE>'||
'<EXPIRE_DATE>0000-00-00</EXPIRE_DATE>'||
'<BATCH/>'||
'<PO_NUM/>'||
'<MATERIAL_DESCRIPTION>POWER SUPPLY</MATERIAL_DESCRIPTION>'||
'<SPEC_NAME/>'||
'<STOCK_CODE>BSW-JH</STOCK_CODE>'||
'<INSPECTION_LOT>00</INSPECTION_LOT>'||
'<USAGE_DECISION_CODE/>'||
'<MATERIAL_GROUP>031</MATERIAL_GROUP>'||
'</RAW_MATERIAL>';
dbms_output.put_line('XML '||xml_message);
-- vp_interface.load_rawmat@cnprpt1_pds(SYSDATE, destination_system,
-- xml_message, p_ret);
vp_interface.load_rawmat(SYSDATE, destination_system,
xml_message, p_ret);
dbms_output.put_line('Return Code '||p_ret);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
status_code := SQLCODE;
status_message := SUBSTR(SQLERRM, 1, 64);
-- Extract_Error_Logger(proc_name, 'LOCAL', SYSDATE, -999,
-- status_message, 0, debug_message);
ROLLBACK;
END send_rm;
And while i am calling this Store procedure in MII, I am facing error.
I have tried different ways but didnt solved
In SQL Query, i kept mode as: FixedQueryOutput
Can anyone tell me or send code for calling above store procedure
And onemore thing, While creating store procedure in Oracle for MII. Do we need to Create output parameter as cursor or normal.
Thanks,
Kind Regards,
Praveen Reddy MHi Praveen
Our wrapper was created because we could not modify the procedure we call (it was not returning a cursor).
CREATE OR REPLACE PROCEDURE CHECK_PUT_IN_USE
(STRCMPNAME in varchar2,
STRSCANLABEL in varchar2,
RCT1 out SYS_REFCURSOR
AS
charDispo Char(1);
charStatus Char(1);
intCatNo Integer;
charCatDispo Char(1);
strCatQual VarChar2(2);
strCatDesc VarChar2(30);
strMsg VarChar2(128);
BEGIN
qa.check_put_in_use@AR(STRCMPNAME,
STRSCANLABEL,
charDispo,
charStatus,
intCatNo,
charCatDispo,
strCatQual,
strCatDesc,
strMsg);
OPEN RCT1
FOR Select charDispo,charStatus,charDispo,charStatus,intCatNo,charCatDispo,strCatQual,strCatDesc,strMsg from Dual;
END;
Hope this helps
Regards
Amrik
then with a FixedQueryWithOutput
call mixar.qasap.wrapper_update_put_in_use('[Param.1]','[Param.2]',[Param.3],?)
Hope this helps. -
XI/PI: jdbc receiver using stored procedure with arrays
The company needs an interface to search for header data and detail to a legacy system.
This interface from ERP to legacy system is synchronous and uses stored procedure.
The definition of the stored procedure is as follows:
PROCEDURE
Generar_Detalle_Vtas_Pagadas
(p_cvendedor IN bdc_vendedores.cvendedor%TYPE,
p_fdesde IN DATE,
p_fhasta IN DATE,
v_encabezado_ct OUT encabezado_ct,
v_detalle_vtas_pagadas_ct OUT detalle_vtas_pagadas_ct,
err_num OUT NUMBER
Data types used in stored procedure:
TYPE encabezado_ct AS OBJECT
( CREGION NUMBER(22),
XREGION VARCHAR2(50),
CMERCADO NUMBER(22),
XMERCADO VARCHAR2(50),
CTVENDEDOR VARCHAR2(5),
XCTVENDEDOR VARCHAR2(50),
XDENOMINACION VARCHAR2(15))
TYPE detalle_vtas_pagadas_ct AS OBJECT
( CITEM VARCHAR2(10),
XIDENTIFICADOR VARCHAR2(15),
XCONTRATO VARCHAR2(15),
XVALOR VARCHAR2(30),
CCUENTA VARCHAR2(15),
FACTIVACION DATE,
XDOMINIO VARCHAR2(30),
CCED VARCHAR2(20),
XCLIENTE VARCHAR2(161),
CCPO VARCHAR2(60) )
As shown, this has three input parameters varchar and date respectively and has three output parameters, two of which are defined with a data
type such as table and the other number.
The problem is to define the signature of the stored procedure in XI when defining the data type request, the message type and mapping system
legacy because the data type is not supported (tables: detalle_vtas_pagadas_ct,encabezado_ct )FORM 2:
defined as an array, but the error tells me that we need to define the attribute either input or output
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_VtasPagadas_VYC xmlns:ns0="urn:VentasPagadas:VE_ALTASDEDCALIDAD_SD_VYC">
<VtasPagadasRequest><Generar_Detalle_Vtas_Pagadas action="EXECUTE">
<table>vyc.Vyc_Pack_Reportes_Sap.Generar_Detalle_Vtas_Pagadas</table>
<p_cvendedor type="VARCHAR"></p_cvendedor>
<p_fdesde type="DATE"></p_fdesde>
<p_fhasta type="DATE"></p_fhasta>
<v_encabezado_ct>
<CREGION isOutput="1" type="NUMERIC">X</CREGION>
<XREGION isOutput="1" type="VARCHAR">X</XREGION>
<CMERCADO isOutput="1" type="NUMERIC">X</CMERCADO>
<XMERCADO isOutput="1" type="VARCHAR">X</XMERCADO>
<CTVENDEDOR isOutput="1" type="VARCHAR">X</CTVENDEDOR>
<XCTVENDEDOR isOutput="1" type="VARCHAR">X</XCTVENDEDOR>
<XDENOMINACION isOutput="1" type="VARCHAR">X</XDENOMINACION>
</v_encabezado_ct>
<v_detalle_vtas_pagadas_ct>
<CITEM isOutput="1" type="VARCHAR">X</CITEM>
<XIDENTIFICADOR isOutput="1" type="VARCHAR">X</XIDENTIFICADOR>
<XCONTRATO isOutput="1" type="VARCHAR">X</XCONTRATO>
<XVALOR type="VARCHAR">X</XVALOR>
<CCUENTA isOutput="1" type="VARCHAR">X</CCUENTA>
<FACTIVACION isOutput="1" type="DATE">X</FACTIVACION>
<ICTA isOutput="1" type="VARCHAR">X</ICTA>
<CCED isOutput="1" type="VARCHAR">X</CCED>
<XCLIENTE isOutput="1" type="VARCHAR">X</XCLIENTE>
<CCPO isOutput="1" type="VARCHAR">X</CCPO>
</v_detalle_vtas_pagadas_ct>
<err_num isOutput="1" type="NUMERIC">X</err_num>
</Generar_Detalle_Vtas_Pagadas>
</VtasPagadasRequest></ns0:MT_VtasPagadas_VYC>
Edited by: ymonasterio on Mar 31, 2010 4:48 PM -
Viewobject - Stored Procedure with sys_refcursor out
Hi,
I have been trying to call an Oracle stored procedure which returns sys_refcursor as an out parameter.
Even though I register out parameter in callStoreFunction method, I am getting "PLS-00306: wrong number or types of arguments in call".
You can find piece of codes below.
Could you please help?
Thanks in advance.
Stored Procedure;*
CREATE OR REPLACE PROCEDURE SP_GET_PRODUCT_DETAIL_BY_ID(
ID_in IN NUMBER,
p_product_refcur OUT SYS_REFCURSOR
IS
BEGIN
OPEN p_product_refcur FOR SELECT * FROM PRODUCT_DETAIL WHERE ID = ID_in;
END SP_GET_PRODUCT_DETAIL_BY_ID;
Java Code*
The code that calls function method;
ResultSet rs = (ResultSet)callStoredFunction(OracleTypes.CURSOR,"SP_GET_PRODUCT_DETAIL_BY_ID(?)",new Object[]{new Number(3)});
Call function method;
protected Object callStoredFunction(int sqlReturnType, String stmt, Object[] bindVars) {
CallableStatement st = null;
try {
System.out.println("222222");
// 1. Create a JDBC CallabledStatement
st = getDBTransaction().createCallableStatement("begin ? := " + stmt + ";end;", 0);
// 2. Register the first bind variable for the return value
st.registerOutParameter(1, sqlReturnType);
if (bindVars != null) {
// 3. Loop over values for the bind variables passed in, if any
for (int z = 0; z < bindVars.length; z++) {
// 4. Set the value of user-supplied bind vars in the stmt
st.setObject(z+2, bindVars[z]);
// 5. Set the value of user-supplied bind vars in the stmt
st.executeUpdate();
// 6. Return the value of the first bind variable
return st.getObject(1);
} catch (SQLException e) {
e.printStackTrace();
throw new JboException(e);
} finally {
if (st != null) {
try {
// 7. Close the statement
st.close();
} catch (SQLException e) {
e.printStackTrace();
}Hi mate,
Sorry about that. My Jdev version is 11.1.2.3.0.
The use case is that I am trying to call a SP from a VO which is triggered from App Module. I have a bind parameter in App Module for SP input, but at the moment I am using a static value for test purpose.
I am able to make a call from App Module to SP via VO but got an error as I am calling with wrong parameters.
Stored Procedure;_
CREATE OR REPLACE PROCEDURE SP_GET_PRODUCT_DETAIL_BY_ID(
ID_in IN NUMBER,
p_product_refcur OUT SYS_REFCURSOR
IS
BEGIN
OPEN p_product_refcur FOR SELECT * FROM PRODUCT_DETAIL WHERE ID = ID_in;
END SP_GET_PRODUCT_DETAIL_BY_ID;
Java Code_
The code that calls function method;
ResultSet rs = (ResultSet)callStoredFunction(OracleTypes.CURSOR,"SP_GET_PRODUCT_DETAIL_BY_ID(?)",new Object[]{new Number(3)});
Call function method;
protected Object callStoredFunction(int sqlReturnType, String stmt, Object[] bindVars) {
CallableStatement st = null;
try {
// 1. Create a JDBC CallabledStatement
st = getDBTransaction().createCallableStatement("begin ? := " + stmt + ";end;", 0);
// 2. Register the first bind variable for the return value
st.registerOutParameter(1, sqlReturnType);
if (bindVars != null) {
// 3. Loop over values for the bind variables passed in, if any
for (int z = 0; z < bindVars.length; z++) {
// 4. Set the value of user-supplied bind vars in the stmt
st.setObject(z+2, bindVars[z]);
// 5. Set the value of user-supplied bind vars in the stmt
st.executeUpdate();
// 6. Return the value of the first bind variable
return st.getObject(1);
} catch (SQLException e) {
e.printStackTrace();
throw new JboException(e);
} finally {
if (st != null) {
try {
// 7. Close the statement
st.close();
} catch (SQLException e) {
e.printStackTrace();
The exact error;
java.sql.SQLException: ORA-06550: line 1, column 14:
PLS-00306: wrong number or types of arguments in call to 'SP_GET_PRODUCT_DETAIL_BY_ID'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredThanks alot. -
** JDBC Receiver - Oracle Stored Procedure - Large Records - Performance
Hi friends,
In my File to JDBC scenario, I use Oracle SP. I designed my target structure as mentioned in help.sap.com. In this scenario, the Sender file sends large no. of records, we have to update those records in the Oracle table. As per this requirement, I did mapping. I tested one file with 4 records. In SXMB_MONI, mapping works fine. I have given below the target payload. The message is processed successfully. (Still I have not created SP in database I am unable to check for the updating of records in the table).
My doubt is
1) Whether the target payload is correct ?
2) For each <STATMENT> tag, Will XI establish connectivity to JDBC and update the record ? If it is, in real time if we send large no. of records, ex: 50 thousand records, performance isssu will come or not?
3) How to solve the problem as said in point 2. (LookUp procedure etc)
Kindly reply friends. (If you have faced this problem ... kindly reply how to solve this issue)
Target Payload:
<?xml version="1.0" encoding="utf-8"?>
<ns1:PSABCL_Mumbai xmlns:eds="http://sdn.sap.com/sapxsl" xmlns:ns0="http://abc.xyz.com" xmlns:ns1="http://abc.xyz.com/ABCL/Finance">
<STATEMENT>
<SP_ABCL ACTION="EXECUTE">
<IF_ROW_STAT>FOR_IMPORT</IF_ROW_STAT><CON_FST_NAME>John</CON_FST_NAME><CON_LAST_NAME>Test001915</CON_LAST_NAME><CON_MID_NAME>W</CON_MID_NAME>
</SP_ABCL>
</STATEMENT>
<STATEMENT>
<SP_ABCL ACTION="EXECUTE">
<IF_ROW_STAT>FOR_IMPORT</IF_ROW_STAT><CON_FST_NAME>Josephine</CON_FST_NAME><CON_LAST_NAME>Walker</CON_LAST_NAME><CON_MID_NAME>Rose</CON_MID_NAME>
</SP_ABCL>
</STATEMENT>
<STATEMENT>
<SP_ABCL ACTION="EXECUTE">
</SP_ABCL>
</STATEMENT>
<STATEMENT>
<SP_ABCL ACTION="EXECUTE">
</SP_ABCL>
</STATEMENT>
</ns1:PSABCL_Mumbai>
Thanking You.
Kind Regards,
Jegathees P.Hi,
The structure should be -
<MsgType Name>
<StatementName>
<storedProcedureName action = "EXECUTE">
<table>
<List of Parameters isInput = "true" type = "STRING">
Map the table node to the stored procedure name.
Also,
For each statement, XI would make a database call. For better performance, do not check the button in CC - Open a new connection to database for each message.
Also another solution would be, collect all the data in the mapping to a comma or a pipe separated string in the mapping and have the statement node created only once. This way, though you have 5000 records, they all will be given to the SP in one DB call. you can also manage the mapping so that you will not send more the the X number of records to database in a single call. We are using an XML created in code in an UDF for this. The SP has to take care of stripping the comma or pipe separated values or the XML sent as a string input parameter.
VJ
Maybe you are looking for
-
PdfMaker en Office 2010 con Adobe 8
Buenas noches me acaban de instalar el office 2010 y no aparece la opcion pdfmaker o la opcion pdf en adobe como lo tenia en el office 2007, tengo la version de Adobe 8, y si miro dentro de complementos si me aperece dentro de complementos y habilita
-
Idoc to RNIF with pdf attachment
Hi I am implementing a Idoc to RNIF with pdf attachment. I have to pick the pdf file from an ftp server in PI based on the invoice number in the idoc. I could not find a blog or documentation on how to attach the pdf file. The only viable solution I
-
URGENT - My Mini wont Shut Down... Help!
Hello all, Suddenly I noticed that after I select shut down from the mac menu, the OS closes and logs off as usual, then the video goes out as it should, but, the mini white light STAYS ON and the USB optical mouse stays powered... What happens? I ca
-
Hi guys. I'm the proud new owner of a sixth generation Pioneer 43" Plasma Screen (http://www.pioneeraus.com.au/home_entertainment/plasmadisplaypanel/pdp436hd/inde x.html). I was wondering if there was ANY way in ALL **** to hook my iMac G5 (Rev A) to
-
Web Service Stub-generation with WTK
Hi there, I hope someone can help me. I just deployed a webservice using Axis. WSDL: http://www.freewebs.com/sirpreis/CustomerWS.xml WSDD (for deployment): http://www.freewebs.com/sirpreis/customerWS-WSDD.xml The WS deploys fine, but now I want to ge