Calling stored procedure multiple times in the JDBC receiver
Hi,
I am calling the stored procedure(SP) to update a DB table in the JDBC receiver.
SP has 10 input parameters, and SP can receive one value for each parameter at a time.
In my case, i will have multiple rows to insert using SP.i.e multiple values for each parameter.
Its working correctly for a single value for each parameter, but when i have multiple values i want to call the SP multiples times.
Is this possible and how?
Thanks,
Varghese.
Varghese,
I think you can have multiple statements in the JDBC Adapter's XML, as in http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm.
Here the StatementName1 node can be inserted into your JDBC XML as often as you want.
Kind regards,
Koen
Similar Messages
-
Calling a vi multiple times makes the timer "crash"
I use a subvi for writing data from a profibusnetwork. In this vi I can set a timer for the "update" to write away the data. I use a global variable to remember the last time the writing was done. The problem I encounter here is that when I use this subvi multiple times only the data I want updated fastest will be written away.. My question is: Is it possible to use just this one vi multiple times instead of renaming it for every datasource I want to write away?
Thx in advance,Use a while loop with an uninitialised shift register instead of a global,
and build it into a function marked "re-entrant". This way different data
exists in each different copy of it in the code.
henk007 wrote in message
news:[email protected]..
> I use a subvi for writing data from a profibusnetwork. In this vi I
> can set a timer for the "update" to write away the data. I use a
> global variable to remember the last time the writing was done. The
> problem I encounter here is that when I use this subvi multiple times
> only the data I want updated fastest will be written away.. My
> question is: Is it possible to use just this one vi multiple times
> instead of renaming it for every datasource I want to write away? -
Out of memory error when calling a java stored procedure multiple times
Trying to run a PL/SQL loop calling a java stored procedure, I get the following error:
"ORA-04030: out of process memory when trying to allocate 262188 byte callheap,ioc_allocate free)"
(with some other error lines).
The stored procedure does two major things:
1) Open a socket to communicate with a server, of which it queries some data.
2) Use JDBC (with the default DB connection it has, as a stored procedure) to write the results to a table.
All socket connections, statements, etc. are properly closed and all memory should be garbage collected between each call.
Can anyone offer an explanation or additional checks to make? I'm quite sure the code isn't causing the problem, since I've tried running it as a stand alone application (outside of Oracle) and didn't have any problems.
Thanks.Hi,
Verify that the database parameters are set correctly.
EA -
SOAP TO JDBC scenario: calling stored procedure which will return the value
Hi
I have Soap To Jdbc scenario in which I am going to call the Stored Procedure at target side which will be executed and it is going to return the result set .
Result contains following values.
return code as ( 0 Or 1) and also specific exception message if its return code as 1.
Could you suggest me the way by which I can handled this return code and send it back to the Sap PI system then the same thing is directed the to SMTP server for sending mail to consern person.
Regards
KumarThe OUT parameters of stored procedure will be returned as response. Where exactly are you facing the proble? Here is a complete walkthourgh
/people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
In your case, you don't want response at sender. Instead you want to mail it. For this you may use BPM to design your scenario with following steps
Receive (to receive data from sender)
Send Sync (to stored procedure and get response)
Send Async (to mail receiver)
Regards,
Prateek -
To execute the same stored procedure multiple times
Suppose I have this :
select distinct batch_id, submit_date from batch where date > xxx;
Gives me :
301
305
306
Currently, I have a stored procedure PROC_A that has 3 cursors all of which have a field called batch_id(which ofcourse exists in the above batch table). Hence, when I run as of today
EXECUTE PROC_A;
This could process an unpredictable set of batch ids. I am looking to avoid this.
What I am trying to achieve here is :
When I do,
select distinct batch_id from batch where date > xxx;
301
305
306
For each of the above values, I want to call the PROC_A exclusively. In other words, by one shot, I want this procedure to be invoked 3 times, each time processing just one batch_id one after another (rather than passing those 3 values to the procedure and having it execute just once !). I also want to avoid using the batch table anywhere inside the stored procedure PROC_A.
How do I achieve this ? If another stored procedure can call PROC_A, I am okay with including the batch table there.What about an executed_date field on the table and a "where rownum=1" in the cursor?
proc_a
begin
begin
select batch_id
into b_id
from batch ...
where date > xxx
and date > last_executed
and rownum = 1;
exception
when NO_DATA_FOUND then
return;
end;
exec(b_id);
update batch
set last_executed = sysdate
where bacth_id = b_id;
return;
end;Bye Alessandro -
Calling stored procedures with parameters with the Database Connectivi​ty Toolkit
Hi all,
I am new to the forum and am having difficulty finding a solution to a particular problem I am having regarding using the LabVIEW Database Connectivity Toolkit on a project I am currently working on at my job. I have a database in which I have tables and stored procedures with parameters. Some of these stored procedures have input, output, and return parameters.
I have been trying to follow this example but to no avail: http://digital.ni.com/public.nsf/allkb/07FD130746083E0686257300006326C4?OpenDocument
One such stored procedure I am working on implementing is named "dbo.getAllowablePNs", which executes "SELECT * from DeviceType" (DeviceType is the table). In this case, it does not require an input parameter, it has an output parameter that generates the table [cluster], and has a return parameter which returns an integer value (execution status code) to show if an error occurred. The DeviceType table has 3 columns; ID (PK, int, not null), PN (nvarchar(15), null), and NumMACAddresses (int, null). I have gone over many examples and have talking to NI support to try to implement this and similar stored procedures in LabVIEW but have not been successful. I am able to connect to the database with the Open Connection VI without error, but am running into some confusion following this step. I am then trying to use the Create Parameterized Query VI to call the stored procedure and set the parameters. I assume I would then use the Set Parameter Value VI for each parameter that is wired into the parameters input on the previous Parameterized Query VI? I am also having some confusion during and following these steps as well. I would greatly appreciate any advice or suggestions anyone might have in regards to this situation as I am not a SQL expert. Also, I would be happy to provide any more information that would be helpful.
Regards,
Jon
Solved!
Go to Solution.Also, I don't know if this would be helpful but here is the actual stored procedure in SQL:
CREATEPROCEDURE [dbo].[getLastSequenceNumber]
@p1 nvarchar(10)='WO-00000'
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SETNOCOUNTON;
-- Insert statements for procedure here
selectmax(SequenceNumber)from Devices where WorkOrderNumber= @p1
END
GO -
Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)
Hi All,
We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
Database is Oracle.
*Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
If both are equal, then
if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
else if the field: 'qq' in YY table equals to "Modify" then take the data from the view table: 'Modify_View'.
Finally, We need to archive the selected data from the respective view table.*
From each table, data will come differently, means with different field names.
I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
Is there any way other than Stored Procedure?
How to handle Data Types as data is coming from two different tables?
Can we create one data type for two tables?
Is BPM required for this to collect data from two different tables?
Can somebody guide me on how to handle this?
Waiting eagerly for help which will be rewarded.
Thanks and Regards,
Jyothirmayi.Hi Gopal,
Thank you for your reply.
>Is there any way other than Stored Procedure?
Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
I need to select the data from different tables based on some conditions. Let me simplify that.
Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
How can we meet this by configuring sender adapter with ATP?
================================================================================================
>How to handle Data Types as data is coming from two different tables?
If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
we need to take data only from one table at a time. It is not join of two tables.
================================================================================================
Thanks,
Jyothirmayi. -
Need sample source code for calling stored procedure in Oracle
Hi.
I try to call stored procedure in oracle using JCA JDBC.
Anybody have sample source code for that ?
Regards, Arnold.Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
I have the Procedure defined as below in the SFCS1 package body
Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
BEGIN
Open O_Cursor FOR
SELECT CompanyId, CompanyName
FROM Company
WHERE CompanyProvince IN ('AL','AK');
END Company_Selection;
In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
DECLARE
A SFCS1.T_Cursor;
BEGIN
SFCS1.Company_Selection(A);
go_Block ('Block36');
The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause. -
Calling Stored Procedure with Paramters in Java
Hi
I havent done alot of sql/java work so I'm wondering if I could get some help.
I have the java code
private void processPatient(Element pat)
throws PatientException,
ParseException,
SQLException,
Exception {
Connection con = null;
ResultSet rs;
CallableStatement cs;
...<code>
cs = con.prepareCall("{call updt_pat.set_pat_ppe}");
rs = cs.executeQuery();
Does this look correct? The proc updt_pat.set_pat_ppe also takes an int parameter...how would I modify this to accept the paramter? Like
cs = con.prepareCall("{call updt_pat.set_pat_ppe paramter}");
Thanks for the help!!
ManiThe actual implementation of what the setInt does and how it does it is up the JDBC driver vendor. Basically its function is as follows (implementation will be driver specific) it takes the int value and passes it to the Stored Procedure being called as the (in this case) 1st input parameter expected by the stored procedure. Whatever the name of the IN variable is within the stored procedure is irrelevant to the JDBC code, basically it will be assigned to the name of the first IN parameter within the Stored Procedure.
The error you are reporting:
xxx.java:272: cannot resolve symbol
symbol : method setInt (java.lang.Integer,int)
location: interface java.sql.CallableStatement
cs.setInt(1, ppath.getPatId());
^
1 error
is interesting as it is claiming that the setInt method requires as its first argument an Integer object - this is not what the specification requires, it just wants an index number as a Java int:
setInt(int index, int value), note no java.lang.Integer
maybe this is a driver specific implementation?
Try the following (not in any specific order):
1 - int value = ppath.getPatId();
cs.setInt(1, value);
2 - Integer index = new Integer(1);
cs.setInt(index , ppath.getPatId());
3 - int = ppath.getPatId();
Integer index = new Integer(1);
cs.setInt(index , value);
Let me know if this solves your problem. -
Setting some QoS params when calling stored procedures
Hi All,
Can I set some QoS params when calling a stored procedure like Timeout, Connection Timeout, Retry Count, etc?
Thanks,
DanielSince anything between your client and your data can fail(including connectivity to the ALDSP server), we recommend that you exercise retries and timeouts from the client. If you attempt to implement retries and timeouts within the XQuery - you open up several cans of worms.(mentioned later) There is a Query Attribute (in RequestConfig) that you can use to specify a timeout on the query. And you can implement retries with a loop (for, while etc).
If you use timeout/fail-over in your query - a number of things happen. First, if something happens outside your timeout or retry - you'll miss it (i.e. if someone unplugs one of your ALDSP servers, the fail-over in your xquery is not going to help). Second, adding timeout/fail-over function calls into your XQuery blocks query optimizations - if you put a fail-over around access to a CUSTOMER table in a database, the optimizer cannot combine that with an access to the ORDER table in the same database). Third, in ALDSP 2.5, the database connections within a query are cached, so if you have Oracle RAC, and one instance goes down - the fail-over function will fail-over to the same instance (unless you create a duplicate data source for the same RAC, but with a different name).
ALDSP does not provide means to configure retries (like ALSB does).
You can explicitly attempt to call a stored procedure mutliple times using the fn-bea:fail-over function.
You can also retry (in case of timeout) by using the fn-bea:timeout function.
Note that during a single query execution, if an instance of fail-over actually fails-over - it will not bother to evaluate the primary expression again during that query execution - it will simply evaluate the secondary expression. (The idea being that if a web service is down, then it will still be down a few milliseconds later). You can contact Customer Support if you need different functionality (there is a fail-over-retry function available in a patch).
If you are calling a replicated web-service, you can implement round-robin in a web-service handler for that web service. Ask if you want an example. -
JDBC-Adapter-Receiver Calling Stored Procedure with Input-Typ Record
Hallo,
I´ m trying calling a stored-procedure with two input-parameter; one of typ record (oracle) and one of type tabel of records. Is this possible (I think there are only types like string, integer etc. possible)? When not is there another possibility to work with that type?
Thanks in advance,
FrankHi Frank,
I think stored procedures will not take Array of Records as a Input. If you want to make a loop funtionality etc then JDBC adapter will work accordingly. You need to just call the stored procedure from the JDBC adapter. It will work for the array of records(multiple occurences).
Receiver JDBC Procedures.
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
Alternative option is you can make use of Java Proxy and from there you can call stored procedure ..I think it is possible.. not tried.
Hope this helps
Regards,
Moorthy -
Can JDBC adapter be scheduled to call stored procedures
Can JDBC adapter be scheduled to call stored procedure in other database passing previous date as input parameter
Hi Gurus,
actually our scenario is jdbc->XI( <-RFC->)->File
Here our payload is around 5000 records
can it be advisable to use rfc synchronous communication.
The scenario will be exected only in night times.so can we schedule the adapter as we are using sp9.
If not what must be the good design approach.
And also after scheduling to a perticular period ,if there is any down time of XI server,will the process start immediately after the sever up or it will again watch for that perticular time. -
Calling Stored Procedure without JDBC-Adapter
Hallo,
as it is not possible calling Stored Procedures with the parameter Typ Record in Oracle my question: It is possible connecting to DB using native java-code for example in Mapping?
Thanks in advance,
FrankHi Frank,
Maybe you can use the DB look up using the JDBC adapter in your mapping.
Just check this blog for the same,
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
As for calling an Oracle Strored Procedure, it is possible using a RECEIVER JDBC adapter, but not a SENDER JDBC adapter.
<i> import the jdbc-driver (oracle) in an archive in Designer.</i>
Also, this imported archive should be under any Namespace, but, it should be in the same SWCV as the one in which the mapping is being executed.
Regards,
Bhavesh -
JDBC Receiver Adapter - Call Stored Procedure
Hi,
I am using a JDBC receiver adapter to call a stored procedure in oracle.
My target structure looks like:-
<STATEMENT>
<storedProcedureName action="EXECUTE">
<table>realStoredProcedureName</table>
<serialDate hasQuot="NO" isInputType="true" type="date">TO_DATE('07-15-2008 08:00:11','MM-DD-YYYY HH24:MI:SS')</serialDate>
<serialNo isInputType="true" type="NUMERIC">123456</serialNo>
</storedProcedureName>
</STATEMENT>
The storedprocedure takes two input values and has one output value.
The first parameter of the stored procedure is serialDate and the second input parameter is serialNo.
I am getting an exception:-
<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'storedProcedureName' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('07"</SAP:AdditionalText>
Any ideas how to fix this issue.
Thanks.
KrishnanHi Krishnan,
<STATEMENT>
<storedProcedureName action="EXECUTE">
<table>realStoredProcedureName</table>
<serialDate hasQuot="NO" isInputType="true" type="date">TO_DATE('07-15-2008 08:00:11','MM-DD-YYYY HH24:MI:SS')</serialDate>
<serialNo isInputType="true" type="NUMERIC">123456</serialNo>
</storedProcedureName>
</STATEMENT>
The storedprocedure takes two input values and has one output value.
The first parameter of the stored procedure is serialDate and the second input parameter is serialNo.
I am getting an exception:-
<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'storedProcedureName' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('07"</SAP:AdditionalText>
In the XML structure you cannot use TO_DATE function . Please pass the DATE in the correct format which the Stored procedure can accept . Get the out put what you expected from TO_DATE function and use that value in the structure.
Regards,
Kishore -
How to call stored procedure with multiple parameters in an HTML expression
Hi, Guys:
Can you show me an example to call stored procedure with multiple parameters in an HTML expression? I need to rewrite a procedure to display multiple pictures of one person stored in database by clicking button.
The orginal HTML expression is :
<img src="#OWNER#.dl_sor_image?p_offender_id=#OFFENDER_ID#" width="75" height="75">which calls a procedure as:
procedure dl_sor_image (p_offender_id IN NUMBER)now I rewrite it as:
PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number)could anyone tell me the format for the html expression to pass multiple parameters?
Thanks a lot.
SamHi:
Thanks for your help! Your question is what I am trying hard now. Current procedure can only display one picture per person, however, I am supposed to write a new procedure which displays multiple pictures for one person. When user click a button on report, APEX should call this procedure and returns next picture of the same person. The table is SOR_image. However, I rewrite the HTML expression as follows to test to display the second image.
<img src="#OWNER#.Sor_Display_Current_Image?p_n_Offender_id=#OFFENDER_ID#&p_n_image_Count=2" width="75" height="75"> The procedure code is complied OK as follows:
create or replace
PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number) AS
v_mime_type VARCHAR2(48);
v_length NUMBER;
v_name VARCHAR2(2000);
v_image BLOB;
v_counter number:=0;
cursor cur_All_Images_of_Offender is
SELECT 'IMAGE/JPEG' mime_type, dbms_lob.getlength(image) as image_length, image
FROM sor_image
WHERE offender_id = p_n_Offender_id;
rec_Image_of_Offender cur_All_Images_of_Offender%ROWTYPE;
BEGIN
open cur_All_Images_of_Offender;
loop
fetch cur_All_Images_of_Offender into rec_Image_of_Offender;
v_counter:=v_counter+1;
if (v_counter=p_n_image_Count) then
owa_util.mime_header(nvl(rec_Image_of_Offender.mime_type, 'application/octet'), FALSE);
htp.p('Content-length: '||rec_Image_of_Offender.image_length);
owa_util.http_header_close;
wpg_docload.download_file (rec_Image_of_Offender.image);
end if;
exit when ((cur_All_Images_of_Offender%NOTFOUND) or (v_counter>=p_n_image_Count));
end loop;
close cur_All_Images_of_Offender;
END Sor_Display_Current_Image; The procedure just open a cursor to fetch the images belong to the same person, and use wpg_docload.download_file function to display the image specified. But it never works. It is strange because even I use exactly same code as before but change procedure name, Oracle APEX cannot display an image. Is this due to anything such as make file configuration in APEX?
Thanks
Sam
Maybe you are looking for
-
I had to install a new hard drive for my macbook after my last one had obviously crashed and was making clicking noises. The problem is I can't install OSX on my new one and I'm getting extremely frustrated. What could be going wrong? I've reset PRAM
-
Hi I have this problem with Adobe Reader 11.0.01. It displays this message "There is a Problem with Adobe Acrobat/Reader. If it is running, please exit and try again (1014:1014). This is in Internet explorer when attempting to open Reader links. This
-
Performance Issue Tracking In Database Level.
Hi All, I am sorry, actually i dont know whether this is the right question to ask in this forum. Below is my question. We are working on Oracle 10g and are supposed to moved to 11G. My question is which text book will be best one for getting knowled
-
ОС windows7 процессор атлон, также греется чипсет но там нет термодатчика. пробовал откатить на Adobe Flash Player 10.3 но при попытке загрузки флэш роликов требует установить обновление и загрузка не происходит
-
Hi All, I have created a transactional iViews and attached it in the protal. This iView Displays a report with Save Button on it. Now this Report works perfectly fine when I try to execute it at the backend. But When we try to execute it through tran