Call stored procedure
Hi:
I have a customer that wants to eliminate direct queries to enterprise databases and invoke stored procedures. This will ease maintenance issues down the line if underlying schema is changed. At any rate the Call Stored Procedure returns the number of rows affected by the call, not the result set(s). I'm hoping I'm missing something in the docs. There has to be a way to execute a stored procedure that returns the result sets.
You're not missing anything. The current implementation of the stored procedure can only return the number of rows affected. They are looking at fixing that in the next release.
The alternative is to use the Execute Script service and use jdbc code to execute your stored procedure. See http://forums.adobe.com/message/2302938#2302938 for an example.
Jasmin
Similar Messages
-
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. -
Call stored procedure with OUT parameter
Hello,
I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
Has someone been able to call a stored procedure with an OUT parameter?
Regards,
NicoObject is Foundation, Execute Script
This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
conn = ds.getConnection();
stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
rs = stmt.executeQuery();
rs.next();
patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
} finally {
try {
rs.close();
} catch (Exception rse) {}
try {
stmt.close();
} catch (Exception sse) {}
try {
conn.close();
} catch (Exception cse) {} -
Creation of DB Adaptert for calling stored procedure in MS SQL server
Hi,
I need to create a DB adapter to call a stored procedure in MS SQL Server.
I have gone thru the thread MS SQL Server database connection
It mentions that we need to use a command line utility for generating the wsdl and xsd for calling stored procedures in MS SQL server. Please provide information where to find this utility and how to use it.
Any links to tutorials are welcome.
Thanks !!.
Silas.Command line is required for stored procedures, if you are using the basic options you don't need to worry.
(1) Download MS SQL Server 2005 JDBC Driver from Microsoft Site. http://msdn.microsoft.com/en-us/data/aa937724.aspx
(2) The download is self extracting exe file. Extract this into Program Files on your machine. It should create folder as "Microsoft SQL Server 2005 JDBC Driver"
(3) In above mentioned folder search for sqljdbc.jar copy this file into JDeveloper\JDBC\lib folder.
(4) Open JDeveloper/jdev/bin/jdev.conf file add following entry.
AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib
While executing this step make sure that your JDeveloper is closed.
(5) On command prompt go to J Developer folder and execute following command
jdev -verbose
This will open JDeveloper.
(6) Now go to JDeveloper > Connections > Database Connections > New Database Connection
(7) Select Third Party JDBC
(8) Specify MS Sql Server User Name, password and Role.
(9) In connection page specify following
- Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
- For class path browse to C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib folder, select sqljdbc.jar add it as library.
- Specify URL as following.
jdbc:sqlserver://SERVERNAME:1433;databaseName=MSSQLDBNAME;
(10) Go to Test page and test it.
cheers
James -
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. -
Calling Stored Procedure with OraClob as parameter IN
I am using Visual C++ and using oo4o the ole way
I am try to call stored procedure that have Clob as parameter in
it seems the the OraParameters Add method don't have the ability since it can only receive variantt.
How do I do it
Thanks
Yoavfyi
Related to the solution/workaround posted by Luc.
see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
regards
Jan Vervecken -
Calling Stored Procedure with in Stored Procedure
I have one stored procedure A, I want to call Stored procedure A from Stored Procedure B and want to give input parameter to Stored Procedure A within Stored Procedure B using while loop.
i.e I have one stored procedure A which uses Telephone number as input parameter and pull out data
I want to create one more stored procedure B which will call stored procedure A internally and give telephone number one by one using while loop and push the result in Table C.>
I have one stored procedure A, I want to call Stored procedure A from Stored Procedure B and want to give input parameter to Stored Procedure A within Stored Procedure B using while loop.
i.e I have one stored procedure A which uses Telephone number as input parameter and pull out data
I want to create one more stored procedure B which will call stored procedure A internally and give telephone number one by one using while loop and push the result in Table C.
>
Doesn't sound a good idea in terms of performance or design. OK, what's your query?
The concept is:
create or replace procedure Proc_A (p_phone varchar2)
is
Begin
Insert into Tablec (col1, col2, col3, phone) values (val1, val2, val3, p_phone);
Exception
When no_data_found then
do what...
End;
Create or Replace Procedure Proc_B as
Begin
For i in (select phone_no from customer)
Loop
Proc_A(i.phone_no);
End Loop;
End;
/Once again, I have to say, it's a bad idea. You may well do it within a single procedure or even a single SQL. Tell us your exact requirements and we'll be able to help you
Edited by: user12035575 on Sep 5, 2011 8:26 PM -
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 -
CALLING STORED PROCEDURE IN DATABASE FROM FORMS4.5
Is there any body know how to call stored procedure from Forms 4.5 ?
I am writing a when-button-pressed trigger.
Put the stored procedure name on there. But
it said "stored procedure name is not declared on this scope".
Thanks a lot
nullTry logging in to SQL*Plus and running the procedure, e.g....
SQL> begin
database_procedure_name(update_web);
end;
If it runs OK there, then it should run from within your form (provided that you are logged in as the same user as the test with SQL*Plus. -
Calling stored procedure in OCCI
Hi, Guys.
I triy to call stored procedure in Oracle database server.But i have problems with taking of the OUT parameters.
How to call the procedure corectly?
Depend on Oracle manual everything is fine but as we see that is not.
Here is the 2 lines that make the problem.
statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
I can't access Type::OCCIINT and Type::OCCIString.
I tried and Type::OCCISTRING but without any result.
Can you help me?
This is the all code i use:
Environment *env = Environment::createEnvironment ( Environment::DEFAULT );
Connection *conn = env->createConnection ( user, pass, osid );
Statement * statement = conn->createStatement ( query );
ResultSet * result = statement->executeQuery ( query );
result->setCharacterStreamMode ( 2, 10000 );
statement->setSQL ( "BEGIN tracetst.get_tst_moduls ( :1, :2, :3 ); END:" );
int if_false;
string __result;
statement->setString ( 1, "116714020010" );
statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
statement->executeUpdate();
if_false = statement->getInt (2);
/* Set the 1,2 args into err_result and modules. The action is only with these */
err_result = if_false;
__result = statement->getString (3);
cout << if_false;
cout << __result;
//printf ( result );
//statement->executeUpdate ( query );
env->terminateConnection ( conn );
Environment :: terminateEnvironment ( env );
While compiling I have an error message.Here it is :
trace.cpp: In member function `const char* oracle_io::get_data()':
trace.cpp:668: error: `oracle::occi::Type' is not an aggregate type
Tha is the line adn the next line is same :
statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
How to call the procedure corectly?
Depend on Oracle manual everything is fine but as we see that is not.
Thanks in advance.
P.S. I would like to thanks to Amogh for helping me before.Did you remove the colon after END ?
Environment *env = Environment::createEnvironment(Environment::OBJECT);
Connection *conn = env->createConnection("scott","tiger","inst1");
Statement *stmt;
int num; string name;
try
stmt=conn->createStatement();
stmt->setSQL ( "BEGIN scott.test ( :1, :2, :3 ); END;" );
stmt->setString ( 1, "11" );
stmt->registerOutParam(2, OCCIINT,sizeof(num));
stmt->registerOutParam(3, OCCISTRING,sizeof(name));
stmt->execute();
num=stmt->getInt(2); name=stmt->getString(3);
cout<<num<<" "<<name<<endl;
catch (SQLException &ex)
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
cout<<ex.getMessage();
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
...Rgds.
Amogh -
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 -
Calling Stored procedure with Parameters in PowerPivot DataModel
Hi All,
I wanted to call a SQL stored procedure from PowerPivot(Excel) on based on changing slicer's value.
Currently, we can call stored procedure wihtout any parameter from Data Model tab using
Exec stored_proc_name in Table Properties window.
What if I want to call the same procedure with a parameter whouse value will come by changing slicer's value. I meant, changing slicer value will act as a parameter to that stored procedure & it should return updated results.
Is this possible in PowerPivot?Hi Rameshwar,
According to your description, you call a SQL Server stored procedure in PowerPivot data model, now the problem is that you need to pass a parameter to the stored procedure, right?
Based on my research, it seems that we cannot achieve this requirement directly in current version of PowerPivot data model. Here is a similar thread for you reference.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5350228d-bc62-4a3b-a1a6-e847483e2858/powerpivot-for-excel-2013-call-execute-stored-procedure-with-parameters?forum=sqlkjpowerpivotforexcel
If you have any concern about this behavior, you can submit a feedback at
http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that they can be, Microsoft might consider to add this feature
in the following release after official confirmation.
Regards,
Charlie Liao
TechNet Community Support -
Calling stored procedure from EJB in JSever
I have some trouble to call stored procedure from EJB deployed to JServer on Oracle8i (815).
I have been able to sucessfully test the stored procedure using thin client JDBC driver. But when I user the default connection in JServer, the stored procedure never got called. Is there any restriction of EJB in JServer?
Thanks
nullThanks man! that was a great help. looks like i am almost there. i created those items t obe hidden.
now i am passing three parameters to the procedure. my url for that column value looks like this,
javascript:P65_PARTITION_ID=#PARTITION_ID#;P65_DBC=#DBC#;P65_FILE_ID=#FILE_ID#;doSubmit('Sku_Save');
the #DBC# parameter is a name of the person that has spaces(firstname lastname). i am getting a javascript error saying,
Line: 1
Char: 37
Error:Expected ';'
i see that char 37 is the space after firstname.
any idea how i should get rid of this error.
Also, as you have been very helpful, a question further beyond :). the above procedure will return a OUT varchar parameter. i guess i have to create another item for that. how do i read it and display just below my report as text.
Thanks Again! -
How to call Stored Procedure in OWB?
Hi,
I'm not able to call stored procedures in the OWB. There are transformations available to call the functions namely Mapping Transformation, but i didnt find any such transformation for stored procedures.
I was able to validate, generate ad deploy the stored procedure, but coudn't find any trasnformation which calls the stored procedure.
And my source and the target are in the same schema, hence a connector module is also not needed.
Can anyone help me in this regard and explain how to call a stored procedure in the Oracle Warehouse Builder?Hi Patrick,
Thanks a lot for your reply.
Hey Patric, sorry to bug you again.
Regarding calling the Stored procedure, mine is a very simple scenario.
I have created a table with two fields say A and B. My stored proc takes an input A1. The stored proc then selects the B field from that table when A1 has the same value as A.
Then i check the condition, if the selected value is null then set the output variable to 'N'. Else to 'Y'.
The logic that i'm following in OWB is:
1.) create a mapping which contains the source as a table.
2.) Give the field A in that table as an input to the Stored procedure which i can have it my Mapping Trasformation.
3.) Then i need to specify the condition that the field A in the table should be equal to A1. And if equal, then fetch the value from the table and display either 'Y' or 'N' based on the condition that is checked in the Procedure.
But the problem here i'm facing is that,i'm not able to store the output into a file, since the procedure doesnot return a value. And my target is a file.
should i need to change my logic.
Regards,
Abhinav. -
How to call stored procedure in hibernate
hi ,
can any one help me how to call stored procedure in hibernate.Given code in hbm.xml
and also plz tell me what is the use of <return-property/>in given hbm.xml file.
<sql-query name="selectEmployees_SP" callable="true">
<return alias="emp" class="com.centris.Employee">
<return-property name="eno" column="eno"/>
<return-property name="ename" column="ename"/>
<return-property name="address" column="address"/>
<return-property name="salary" column="salary"/>
{ ? = call p_retrieve_employees() }
</return>
</sql-query>Hi,
Your question isn't related to Java Programming and should be asked in a [Hibernate forum|http://forum.hibernate.org/]
Kaj -
How to use @jws:sql call Stored Procedure from Workshop
Is there anyone know how to use @jws tag call Sybase stored procedure within
Workshop,
Thanks,Anurag,
Do you know is there any plan to add this feature in future release? and
when?
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
In the current release, we do not support calling stored procedures from a
database control. You will have to write JDBC code in the JWS file to call
stored procedures.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Anurag,
I know how to use DB connection pool and create a db control with it. In
fact, we have created a Web Service with the db control using plain SQL
in
@jws:sql. However, my question here is how to use @jws tag in Weblogic
Workshop to create a Web Services based on Sybase stored procedure orany
Stored Proc not plain SQL.
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
You can use a database control to obtain a connection from any JDBC
Connection Pool configured in the config.xml file. The JDBC Connectionpool
could be connecting to any database, the database control is
independent
of
that.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Is there anyone know how to use @jws tag call Sybase stored
procedure
within
Workshop,
Thanks,
Maybe you are looking for
-
Hi. We need SSO from Non-SAP portal to EP. The Non-SAP Portal has publish Form-based authentification. I mean userid&password set to URL. Then the EP can generate SAP Logon ticket to backend system? regards,
-
IPod touch stuck on USB connect screen but not recognized by iTunes
I downloaded the update for my iPod via iTunes but when the update attempted to install on the iPod, I received a message that the update failed. Now, my iPod is stuck on the USB connect screen (with the image of a cord below an arrow pointing to the
-
Does iPhone do Video Out via video cables?
I can't find any reference to this in the iPhone user guide, so I'm guessing it can't, but I thought I'd ask here. Can iPhone send video out to an external TV using the iPod Video Connection Cable?
-
how do I save and insert into mail a scanned document?
-
Auto resizing of non-resizeable controls
Is it possible to have controls which by default are not resizeable (e.g. ImageView, MediaView) to be automatically resized as their parent node is resized? If so, how can this be achieved? Thanks, -Luc