Stored procedure design(IDoc to JDBC)
I need design inputs from you people,
My requirement as follows, we are creating orders(IDoc) in SAP and want to insert data in to Data base table, one IDoc data to be inserted in to multiple tables(min 4).I developed interfaces it is working fine, sometimes we expect 50k orders from SAP per day,i.e 50K IDocu2019s , it min 2lac insert operations performing on data base ,so planning to change my design.
How can I reduce number of insert statements to process 50k IDocu2019s per day.
Using stored procedure one option but stored procedure structure bit different. Like if I want to insert data 10 times in to data base table, then I written logic to repeat access tag multiples times.
But how can I do it stored procedure.
Any pointers?
You can seek help from JDBC guys to create a Stored Procedure which accept the structure once and distribute it to 4 tables. So you need to push data only once.
Like if I want to insert data 10 times in to data base table, then I written logic to repeat access tag multiples times.
This part can also be handled in SP.
Regards
Raj
Similar Messages
-
How to use Stored Procedure Call in Sender JDBC adapter
Hi All,
Could someone send me a blog on how to use Stored Procedure call in Sender JDBC adapter?
XierHi Xler
refer these links
/people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Also, you can check Sriram's blog for executing Stored Procedures,
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
/people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
This blog might be helpfull on stored procedures for JDBC
JDBC Stored Procedures
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
Please go through these threads and see if it helps...
Re: How to execute Stored Procedure?
Re: Problem with JDBC stored procedure
Thnaks !! -
Invoking Oracle stored procedures from within a JDBC channel for PI 7.1
Hi ,
Can anybody tell me that is it possible to invoke Oracle stored Procedure from within a JDBC sender channel for PI 7.1.
Its working in XI3.0 and XI 7.0 for Oracle DBMS versions >= 10.2.x. But I am not sure,whether it will work for PI 7.1 also.
Thanks & Regards,
SaruHI,
refer below link,there is no much difference in PI7.1 ,executing stored procedure is same .
http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/7b72b2fde93673e10000000a114a6b/content.htm
Regards,
Raj -
APEX fails with Java stored procedure that creates a JDBC connection
Hello!
We are facing a strange problem since we have upgraded from Oracle 10g and Apache to Oracle 11g with Embedded Gateway.
Here is what we do:
** APEXX calls a PL/SQL package function "OPEN_CONNECTION" that wraps a Java stored procedure called "openConnection".*
FILE_READER_REMOTE_API.openConnection(user, password, host, port, service);
** The Java stored procedures "openConnection" opens a JDBC connection to an other database:*
public class FileReaderRemote {
private static Connection conn = null;
private static DefaultContext remoteContext = null;
public static void openConnection(String user, String password, String host, String port, String service) throws SQLException {
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
java.util.Properties props = new java.util.Properties();
props.put ("user", user);
props.put ("password", password);
//props.put ("database", "//" + host + ":" + port + "/" + service);
props.put ("database", host + ":" + port + ":" + service);
props.put("v$session.program", "FileReaderRemote2");
// Connect to the database
remoteContext = Oracle.getConnection("jdbc:oracle:thin:", props);
This procedure used to work fine before the upgrade, but now we see the following:
* It still works when called directly from TOAD or SQL*Plus, even under the user ANONYMOUS.
* When called from APEX and the target database is Oracle 11g, it still works.
* When called from APEX and the target database is Oracle 10g, it takes several minutes and we receive this error:
*"Socket read timed out"*
We have tested the following workaround:
We have created a database link to our own database and called the stored procedure through that database link.
FILE_READER_REMOTE_API.openConnection*@loopback*(user, password, host, port, service);
This works, but is not really an option.
I hope some one of you can explain this strange behaviour to me.
Best regards,
MatthiasYou wrote
"Java stored procedures -- by definition - are stored in the 8i rdbms. !!"
From the Oracle8i Java Stored Procedures Developer's Guide
Release 8.1.5
A64686-01
"If you create Java class files on the client side, you can use loadjava to upload them into the RDBMS. Alternatively, you can upload Java source files and let the Aurora JVM compile them. In most cases, it is best to compile and debug programs on the client side, then upload the class files for final testing within the RDBMS"
This means that you can create shared classes that are used on both the client and server side. The source does not need to reside within the server (according to their documentation). Please also note the following from the Oracle8i JDBC Developer's Guide and Reference Release 8.1.5 A64685-01 for using the getConnection() method on the server:
"If you connect to the database with the DriverManager.getConnection() method, then use the connect string jdbc:oracle:kprb:. For example:
DriverManager.getConnection("jdbc:oracle:kprb:");
Note that you could include a user name and password in the string, but because you are connecting from the server, they would be ignored."
So if you're coding a shared class that is to run on both the client and server side, you might do something like this:
Connection conn =
DriverManager.getConnection(
System.getProperty("oracle.server.version") == null
? "jdbc:oracle:thin:@hostname:1521:ORCL"
: "jdbc:oracle:kprb:"),
"youruserid","yourpassword");
As stated earlier, the userid and password are supposedly ignored for server connections retrieved in this manner. I haven't tried this yet, but it is documented by Oracle.
Regards,
Steve
null -
When would you write a stored procedure in sender/receiver jdbc adapter
Hi Everybody
Can you tell any situation where you would need to write a stored procedure in the query sql statement of sender/ receiver jdbc adapter instead of writing SELECT statement there
why do we need to write stored procedures
thanks and regards,
AnithaHi Anitha,
why do we need to write stored procedures
Some times a single SQL statement will not suffice for ur transactions....
Say u want to access from 2 tables and update based on some condition..
or nested select statement...
or u want to update a 2 nd table based on the values from 1st table... etc..
In those places it's preferable for going for a Stored Procedure.
The Stored Procedure can be used in both Sender and Receiver JDBC Adapter.
Still nt clarified do post..
Babu -
Stored Procedure issue in receiver JDBC synchronous scenario
Dear Experts,
Below is the description of the Stored Procedure for my requirement which has 1 input and 7 output.
CREATE OR REPLACE PROCEDURE emp_det_proc
p_emp_id IN NUMBER,
cur_det OUT sys_refCURSOR
aS
BEGIN
OPEN cur_det FOR
SELECT * FROM EMP_PERSON_VIEW
WHERE id = p_emp_id;
END emp_det_proc;
Inside the procedure , we can see that Select query is done on a VIEW which has some 7 column and these are the output. The data type description of the ID is VARCHAR2 in Oracle Database 11g VIEW, that's why I maintained VARCHAR in Constant mapping at SAP-PI side.
I am maintaining all the column name present in the view for my JDBC request structure with isOutput and type.
Below is my JDBC request.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_ECCJDBC_EmpStrdProc_JDBCReq xmlns:ns0="urn:empdet:sap:jdbc:storedprocedure">
- <Statement>
- <emp_det_proc action="EXECUTE">
<table>emp_det_proc</table>
<ID isInput="true" type="VARCHAR">200178</ID>
</emp_det_proc>
</Statement>
</ns0:MT_ECCJDBC_EMPStrdProc_JDBCReq>
I tested with other XSD type like INT/CHAR/ but with the same error.
Unable to execute statement for table or stored procedure. 'emp_det_proc' (Structure 'Statement') due to java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'EMP_DET_PROC'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
1. I observed that the Key field ID is maintained as NUMBER in Stored Procedure but in the VIEW it is maintained as VARCHAR2.
Could anyone help me to solve the issue with any suggestions?
Regards
RebeccaDear Ramesh,
There are change in the datatype of the Stored Procedure Input parameter. Below is the correct procedure description now.
Select query of the View
My JDBC structure
Observation and querry:
1. In the SP declaration, there is 1 IN parameter which I have created in JDBC structure as p_moi_id and gave the type as INTEGER.
Error : JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'moi_det_proc' (structure 'Statement'): java.lang.NumberFormatException: For input string: "2*********&49"
I assume since the range of the number is limited . Integers are values up to 2147483647 and the number I am using is greater than this values.
2. I assume I have not included the parameter cur_det as OUT. Instead I have maintained the COLUMN names of Select query of the view. Should I remove all the Out parameters which represents inside the View.
3. What could be the Data type equivalent to Oracle sys_refCURSOR in SAP PI?
Please share you suggestion.
Regards
Rebecca -
Using a stored procedure for a sender jdbc adapter
Hi all,
The requirement is to use a stored procedure, for extracting data from a oracle database.
Is it possible to do this.
If yes, what should be the source structure in this case.
Please help with the exact soln.
Thanks!!
YounusHi,
Did you check the blog pointed by Aamir?
/people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
You will need to use Oracle Functions instead of Oracle Stored Procedures. Read thru the blog and the note pointed in the blog . Think it is quite a good example.
Regards
Bhavesh -
Stored Procedure Call Syntax in JDBC 3.0
Does anybody know if the JDBC 3.0 spec allows the following syntax of a CALL statement? I am using the IBM DB2 JDBC Univeral Driver Architecture Version: 2.5.36 driver, which is suppose to be JDBC 3.0 compliant, and am getting an exception. However, when I use the pervious version of the driver (1.9.32), this CALL statement works perfectly. Thanks for your help.
CALL STATEMENT:
CALL SIDBT01.SIZSC005(CCDLRCODE = ?, CCDASMNBR = ?, CCDASMNAME = ?, WSSQLCODE = ?, SQLREASON = ?)
EXCEPTION:
com.ibm.db2.jcc.a.SqlException: String Literals not supported in procedure calls to DB2/390Yes, it should be.
You can run a test by defining any "bogus" interface for the response and take a look in SXMB_MONI for the exact structure returned. Then, define the message type based on this structure, so mapping can be done.
Regards,
Bill -
Need stored procedure design flow diagram using visio or anything else
ad
Edited by: user538171 on Jan 25, 2012 5:45 PMuser538171 wrote:
This is for documentation for that procedure, I can judge whether it is correct or not or else I will correct with your help.*This is a forum of volunteers as mentioned before. We're here to help people who are having issues with SQL or PL/SQL specifically, not documentation. You are asking for someone to reverse engineer your code and provide documentation for it for free. You will be very hard pressed to find someone here that will do it.
I'm sure you can do it yourself. if you understand how the code works, you'll be able to go through it step by step and write what each part is doing. Then convert this specific "what it is doing" into business language if required (something that's impossible for people who don't understand your business to do). Then stick boxes around these distinct bits of process and draw lines between them.
easy :-) -
How to put Stored Procedure in Receiver JDBC channel
Hi all,Good Evening,Iam using a JDBC to JDBC scenario in which I have to move the data from database into XI and we all know that the Interfaces which require stored procedures on Oracle database server for publishing the data needs to be called in combination of BPM & Receiver JDBC adapter.
In this method, a dummy interface will be created for triggering the process. This interface could be designed using any adapter which works on polling mechanism (sender JDBC/File). Dummy interface will invoke a small BPM designed for each business object. BPM will make a synchronous call to Oracle database by calling underlying stored procedure. Stored procedure will return the result set by using a cursor. BPM will send this result set to target application.
Now my question is how to put a stored procedure in a receiver JDBC channel which need to collect the data from database when BPM makes a synchronous call.
Because it is required in my scenario,can any one tell me how and where to put stored Procedure in JDBC receiver channel.
Thanks in advance,
Regards,
PrajwalYour action should be EXECUTE for stored procedures in Message mapping.
<StatementName5>
<storedProcedureName action=u201D EXECUTEu201D>
<table>realStoredProcedureeName</table>
<param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
</storedProcedureName >
</StatementName5>
action=EXECUTE
Statements with this action result in a stored procedure being executed. The name of the element is interpreted as the name of the stored procedure in the database. If you use the optional <table> element, the value specified here is used as the stored procedure name. This enables you, for example, to define stored procedure names containing non-XML-compatible characters or characters that prevent them from being used in interface definitions in the Integration Builder/PCK. If specified, <table> must be the first element in the block within <dbTableName>.
The elements within the stored procedure are interpreted as parameters. They can optionally have the attribute isInput=u201C1u201C (input parameter) or isOutput=u201C1u201C (output parameter) or both (INOUT parameter). If both attributes are missing, the element is interpreted as an input parameter. The parameter names must be identical to those of the stored procedure definition.
The attribute type=<SQL-Datatype> , which describes the valid SQL data type, is mandatory for all parameter types (IN, OUT, INOUT).
http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
/people/sap.user72/blog/2005/10/15/jdbc-adapter-execution-mode-chained-or-unchained
/people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi -
JDBC Adapter - Sender - Stored Procedure - SQLException Error
Hi,
I have created one stored procedure in our Oracle database. I give below that stored procedure.
CREATE OR REPLACE PROCEDURE sp_stud
IS
l_row student%ROWTYPE;
TYPE t_ref_cursor IS REF CURSOR RETURN l_row%TYPE;
c_cursor t_ref_cursor;
BEGIN
OPEN c_cursor FOR
SELECT *
FROM student where readflag= ' ';
LOOP
FETCH c_cursor into l_row;
EXIT WHEN c_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(l_row.id || ' : ' || l_row.name);
END LOOP;
close c_cursor;
END;
This is a procedure to retreive rows from the table student which is having the field read_flag = ' '; (Student table contains the fields ID, NAME, BIRTHYEAR, BIRTHMONTH, READFLAG).
In JDBC Sender Adapter, I set the values for the following fields under Parameters tab.
Query SQL Statement: EXECUTE sp_stud
Update SQL Statement: UPDATE student SET readflag = 'Y' where readflag = ' '
The scenario is every 5 minutes JDBC adapter checks the table whether any new row is inserted, if it is inserted and commit, it will send that record to File. This is the Scenario.
In Runtime Workbench, Communication Channel Monitoring, it shows the following error, when JDBC Polls the table.
Database-level error reported by JDBC driver while executing statement 'EXECUTE sp_stud'. The JDBC driver returned the following error message: 'java.sql.SQLException: ORA-00900: invalid SQL statement '. For details, contact your database server vendor.
Note : If we execute the Stored Procedure ad SQL command level, it works fine.
Kindly help friends to solve this, where the error is happened.
Thanking you,
Kind regards,
Jegatheeswaran P.Hi,
Not a Database expert. But , in case you have not seen the note pointed by Deepu,
<i> The JDK 1.1.x, 1.2 and 1.3 versions (classes111. zip, classes12.zip, classes12.jar) of the driver are not compatible with the SAP XI JDBC Adapter. Use the JDK 1.4 driver (ojdbc14.jar) instead. For details, refer to Oracle MetaLink note # 203849.1.
<b>Invoking Oracle stored procedures from within a JDBC sender channel is only possible for Oracle DBMS versions >= 10.2.x using so-called table functions:</b>
Example:
pkg1 -
CREATE PACKAGE pkg1 AS
TYPE numset_t IS TABLE OF NUMBER;
FUNCTION f1(x NUMBER) RETURN numset_t PIPELINED;
END pkg1;
CREATE PACKAGE BODY pkg1 AS
-- FUNCTION f1 returns a collection of elements (1,2,3,... x)
FUNCTION f1(x NUMBER) RETURN numset_t PIPELINED IS
BEGIN
FOR i IN 1..x LOOP
PIPE ROW(i);
END LOOP;
RETURN;
END;
END pkg1;
pkg1 -
<b> This function has to be invoked from the sender channel configuration (SELECT statement) as follows:
SELECT * FROM TABLE(pkg1.f1(5));</i></b>
Check this, confirm your Oracle DB version and then use the Table Functions as described in this note.
A Database Expert wil be able to crack this for sure.
Regards
Bhavesh -
Sender JDBC Adapter Supports Stored Procedures????
Dear All,
I was trying to use the Sender JDBC adapter to call the Stored procedure in the Sender JDBC adapter is possible to do this???
I don't think Sender JDBC Adapter is supported to execute the Oracle Started Procedures. With my understanding only the Receiver JDBC Adapter will supported for the Stored Procedures using the message mapping Action = EXECUTE and Table = DBO.EmployeeMasterTable.
Please let me know how to achieve the below scenario.
My Scenario JDBC to RFC
Query SQL Statement:
select * from dbo.emp where flag = 'Insert' or flag = 'Update' or flag = 'Delete'
Update SQL Statement:
UPDATE dbo.emp SET flag = null WHERE flag IN ('Insert', 'Update');
DELETE dbo.emp WHERE flag = 'Delete';
In the my update statement I need to update few data flag with Insert , Update and need to delete the of the old records as mentioned above the query.
In the response mapping I am using the Action = INSERT and Table = emp.
Thanks,
Jane F.Hi Jane,
>>My requirment is to select from the DB and update and delete needs to be done. How I need to call this stored procedure in Sender JDBC adapter.
An example of SP call is mentioned in the previous note Note 941317 - XI / PI JDBC Adapter: Known Problems / Incompatibilities
SP Code
---------- pkg1 ----------
CREATE PACKAGE pkg1 AS
TYPE numset_t IS TABLE OF NUMBER;
FUNCTION f1(x NUMBER) RETURN numset_t PIPELINED;
END pkg1;
CREATE PACKAGE BODY pkg1 AS
-- FUNCTION f1 returns a collection of elements (1,2,3,... x)
FUNCTION f1(x NUMBER) RETURN numset_t PIPELINED IS
BEGIN
FOR i IN 1..x LOOP
PIPE ROW(i);
END LOOP;
RETURN;
END;
END pkg1;
In sender channel mention
>> SELECT * FROM TABLE(pkg1.f1(5));
>>Is this need to be in the one stored procedure right. Can ou let me know how it should be handled in JDBC Adapter.
Yes it shoudl be a single SP. Mention a select statement as given in above example.
What is your Oracle version?
Regards
Suraj -
Sender JDBC adapter : Update SQL Statement : stored procedure
Hi,
Can we use a stored procedure in the sender jdbc adapter in 'Update SQL Statement'.
The problem i am facing is like, we are selecting data from two tables in 'SQL statement for query' and then in 'Update SQL Statement' , we need to delete that data from these two tables.
Please let me know if it is possible.
Thanks,
Rohityou can use a Stored procedure in the
Query SQL Statement
You have the following options:
· Specify a valid SQL SELECT statement to select the data to be sent from the specified database.
· Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs.
so have your whole select and update as part of this single Stored procedure -
Stored procedures and JDBC Adapter
Hey guys ,
any blog where i canlook up w.r.t. working with any stored procedure through xi ?
Appreciate ur help.
KrishnaHi Krishna,
Here you go-
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
Also remember that, Sender JDBC Adapter doesnot support Oracle Stored Procedures. Because Sender JDBC Adapter sends resultset to XI. But Oracle stored procedure returns Cursor.
I think, if you are using other database then it may support.
Regards,
Moorthy -
Jdbc receiver stored procedure call
This is my stored procedure in sybase
create procedure fn_acf2
@proj_name char(4),
@ver char(1),
@function_code char(4),
@ident_number char(9),
@agent_id char(6)
as
declare @msg char(30)
declare @return_code int
declare @str_return char(5)
begin
if @ver != "1"
begin
print "Invalid version number for 'FNA2'"
return(-1)
end
execute @return_code = SGW003...fn_acf2_security @proj_name, @ver, @function_code, @ident_number, @agent_id
if @@error != 0
begin
select convert(char(5),@return_code)
end
else
return (@return_code)
end
go
MY REQUEST structure looks like
MT_Sybase_Request
statement (element of MT_Sybase_Request)
fn_acf2 (element of statement)
action (attribute of fn_acf2) ( have hard coded as EXECUTE)
proj_name(element of fn_acf2)
type (attribute of proj_name) hard coded as char
isInput (attribute of proj_name) hard coded as 1
ver(element of fn_acf2)
type (attribute of ver) hard coded as char
isInput (attribute of ver) hard coded as 1
funtion_code(element of fn_acf2)
type (attribute of function_code) hard coded as char
isInput (attribute of function_code) hard coded as 1
ident_number(element of fn_acf2)
type (attribute of ident_number) hard coded as char
isInput (attribute of ident_number) hard coded as 1
agent_id(element of fn_acf2)
type (attribute of agent_id) hard coded as char
isInput (attribute of agent_id) hard coded as 1
Should i put element name under statement as fn_acf2 or fn_acf2_security
Is the above structure correct?
I have followed these blogs
JDBC Stored Procedures
SYNCHRONOUS SOAP TO JDBC - END TO END WALKTHROUGHall elements are under fn_acf2
but i want you guys look my Stored procedure
execute @return_code = SGW003...fn_acf2_security @proj_name, @ver, @function_code, @ident_number, @agent_id
in the above stmt,
iam confused why it fn_acf2_security was used instead of an_acf2 ( fn_acf2 is my Stored procedure name)
what does execute @return_code mean ( actually return_code is my response structure element)
my response wil have only elemnt which is return_code.
Maybe you are looking for
-
Re: Error code CL-0x000f
Having the same issue. Keeps goind in and out. Its really getting to be a pain as im unable to watch the shows i want when i want.
-
Hi, I was wondering if anyone had a simple solution on using a TreeView control with checkboxes. The only required functionality would be: Clicking on the CheckBox beside an item that has children will result in all children also becoming selected/un
-
Connect Contacts on MAC Mail Software
I have another question. I am wondering if it's possible to connect the contacts I have on the server and I can see on my webmail to the Macintosh Mail software. Is it an LDAP? I am not talking for the global userlist. I am talking about the personal
-
I downloaded 4 songs at the same time. The first and the last songs in the list play fine. If I try to play the second or third I get the message that I need to authorise this computer. I enter my id and password and it will say I've already authoris
-
Re: Satellite A210-14S - I lost BIOS Password
Hi, i lost my Bios-password at my A210-14s. Now i am not avalible to change my Bios Settings... What can i do against this problem? Tw33k.