??? Calling oracle stored procedure
hi All,
I have created one user-defined type in Oracle. say for ex:-
create type address (no varchar2, place varchar2, city varchar2, state varchar2, nation varchar2);
Then i created one procedure, which have this data-type as an argument with in and out parameter.
Now i have to call this procedure from java, where i have to pass the values from java.. and i have to get prcoessed in oracle, and these results i have to get in java.
I have tried lot of online resources, but it is not working.. i dont know where i am doing mistake.. so...
Any one can send me a sample code... to my email id... plz.. [email protected]
Thanks in advance,
Rajkumar
Hi,
Thanks for replying...
1. First i created a user-defined type in oracle as follows:-
create or replace type address as object (
home varchar2(80),
office varchar2(80))
2. The above is created. then i created one table refereing the above data-type in my table as follows:-
CREATE TABLE EMPLOYEE (
NAME VARCHAR2 (20),
ADDR ADDRESS ) ;
3. the above script is working fine. i inserted one row in the above table.
4. in oracle i created one procedure passing the user-defined type as an argument. i need values to be passed from java and get processed in oracle and i have to get these processed result in java. hence i set the parameter as "in out" type. the procedure is as follows:-
CREATE OR REPLACE procedure exampleMap(parammap in out address) As
begin
select addr into parammap from employee;
end;
5. To map this oracle user-defined data type. i created one java class as follows:-
import java.sql.SQLData;
import java.sql.SQLException;
import java.sql.SQLInput;
import java.sql.SQLOutput;
class Address implements SQLData {
private String home;
private String office;
public Address() {}
public void readSQL(SQLInput inStream, String typeName) throws SQLException {
// super.readSQL (stream, typeName);
home = inStream.readString();
office = inStream.readString();
public void writeSQL(SQLOutput outStream) throws SQLException {
// super.writeSQL (stream);
outStream.writeString(home);
outStream.writeString(office);
public String getSQLTypeName() {
return "ADDRESS";
public String getHome() {
return home;
public String getOffice() {
return office;
public void setHome(String s) {
home = s;
public void setOffice(String s) {
office = s;
6. Then i written one java class, that calls my oracle procedure which passes the user-defined type and gets back the result... the code is as follows:-
import java.sql.*;
import java.io.*;
import oracle.sql.*;
import java.util.Map;
//import java.util.Dictionary;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.jdbc.driver.OracleTypes;
public class CallableExampleOra {
public static void main(String[] args) {
try {
String url = "jdbc:oracle:thin:@10.102.52.52:1521:orcl";
String driver="oracle.jdbc.driver.OracleDriver";
Class.forName(driver);
Connection connection = DriverManager.getConnection(url,"raj","raj");
Address a = new Address();
Class c = Class.forName("Address");
Map typeMap = connection.getTypeMap();
typeMap.put("RAJ.ADDRESS",c);
String cmd = "{ call exampleMap(?) }";
OracleCallableStatement csmt = (OracleCallableStatement) connection.prepareCall(cmd);
System.out.println("No Error ...");
csmt.registerOutParameter(1,Types.STRUCT,"ADDRESS");
System.out.println("Solved...");
csmt.setObject(1,a);
System.out.println("3 over");
// ResultSet rs = csmt.executeQuery();
csmt.execute();
System.out.println("after rs...");
// Address addr = (Address)csmt.getObject(1);
// STRUCT addr = (STRUCT)rs.getObject(1);
/* STRUCT addr = (STRUCT)csmt.getObject(1);
if (addr.isConvertibleTo(c))
System.out.println("can be...");
else
System.out.println("Cannot be...");*/
/* Object o = csmt.getObject(1);
if (o != null) {
System.out.println("Object exists..");
if (o instanceof Address)
System.out.println("Address");
else
System.out.println("Unknown..");
STRUCT s = (oracle.sql.STRUCT)csmt.getObject(1);
if (s != null) {
String sqlname = s.getSQLTypeName();
// Object[] attrs = s.getAttribute();
Object[] attrs = s.getAttributes();
System.out.println("sqlname: " + sqlname);
if (sqlname.equals("RAJ.ADDRESS")){
System.out.println("i got it");
csmt.close();
connection.close();
System.out.println("ret...");
// System.out.println("Home: " + addr.getHome());
} catch(Exception e) {
System.out.println("Exception :"+e);
System.out.println("Nothing done");
7. i compiled the code.. no compilation error. when i try to compile the above java file. sometimes it shows error like "java type mismatch", "unbound type", and in sometimes no result(hanging state)
So, this is the problem i am facing. if their is any blunder mistake in spelling or in coding or in someother plz excuse me.
i dont want the above as template. i want just o/p thats it.
Thanks in advance,
Rajkumar
Similar Messages
-
PLS-00306:NET to call Oracle stored procedure,Use Array parameters
Development Environment:Windows 2003 SP2+Oracle 10g
. NET to call Oracle stored procedure, use an array of types of parameters
Step1:(In the Oracle database define an array of types)
CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
OR
CREATE OR REPLACE type string_array is table of nvarchar2(255)
Step2:
CREATE OR REPLACE PROCEDURE Test
(i_test in string_varray,o_result out int)
IS
BEGIN
o_result:=i_test.count;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
o_result:=0;
END arraytest;
Step3:
ODP.NET(Oracle 10g)
OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
OracleCommand cmd = new OracleCommand("Test", conn);
cmd.CommandType = CommandType.StoredProcedure;
string[] str = new string[2] { "11", "222" };
cmd.ArrayBindCount=2;
OracleParameter p1 = new OracleParameter("i_test", OracleDbType.NVarChar);
p1.Direction = ParameterDirection.Input;
p1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p1.Value = str;
p1.ArrayBindSize=new int[2]{2,3};
p1.ArrayBindStatus = new OracleParameterStatus[2]{
OracleParameterStatus.Success,
OracleParameterStatus.Success
cmd.Parameters.Add(p1);
OracleParameter p2 = new OracleParameter("o_result", OracleDbType.Int32);
p2.Direction = ParameterDirection.Output;
P2.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p2.Value=0;
cmd.Parameters.Add(p2);
int i = 0;
try
conn.Open();
cmd.ExecuteNonQuery();
i =(int) p2.Value;
catch (Exception ex)
finally
conn.Close();
Error:
Execution Failed:ORA-06550:Line 1,Column 7:
PLS-00306:Test parameters when calling the number or types of errors
ORA-06550:Line 1,Column 7:
PL/SQL:Statement ignoredHi,
See the answer in [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=909564&tstart=0]
Hope it helps,
Greg -
. NET to call Oracle stored procedure, use an array of types of parameters
. NET to call Oracle stored procedure, use an array of types of parameters
Step1:(In the Oracle database define an array of types)
CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
Step2:
CREATE OR REPLACE PROCEDURE Test
(i_test in string_varray,o_result out int)
IS
BEGIN
o_result:=i_test.count;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
o_result:=0;
END arraytest;
Step3:
Use System.Data.OracleClient
C# Code:
OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
OracleCommand cmd = new OracleCommand("Test", conn);
cmd.CommandType = CommandType.StoredProcedure;
string[] str = new string[] { "11", "22" };
OracleParameter p1 = new OracleParameter("i_test", OracleType.NVarChar);
p1.Direction = ParameterDirection.Input;
p1.Value = str;
cmd.Parameters.Add(p1);
OracleParameter p2 = new OracleParameter("o_result", OracleType.Int32);
p2.Direction = ParameterDirection.Output;
cmd.Parameters.Add(p2);
int i = 0;
try
conn.Open();
cmd.ExecuteNonQuery();
i =(int) p2.Value;
catch (Exception ex)
finally
conn.Close();
Error:
Execution Failed:ORA-06550:Line 1,Column 7:
PLS-00306:Test parameters when calling the number or types of errors
ORA-06550:Line 1,Column 7:
PL/SQL:Statement ignored
Edited by: user10133982 on Jun 4, 2009 7:13 AM. NET to call Oracle stored procedure, use an array of types of parameters
The use of ODP.net(Oracle 10g), the error is still the same
Step1:(In the Oracle database define an array of types)
CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
Step2:
CREATE OR REPLACE PROCEDURE Test
(i_test in string_varray,o_result out int)
IS
BEGIN
o_result:=i_test.count;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
o_result:=0;
END arraytest;
Step3:
ODP.NET(Oracle 10g)
OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
OracleCommand cmd = new OracleCommand("Test", conn);
cmd.CommandType = CommandType.StoredProcedure;
string[] str = new string[2] { "11", "222" };
cmd.ArrayBindCount=2;
OracleParameter p1 = new OracleParameter("i_test", OracleDbType.NVarChar);
p1.Direction = ParameterDirection.Input;
p1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p1.Value = str;
p1.ArrayBindSize=new int[2]{2,3};
p1.ArrayBindStatus = new OracleParameterStatus[2]{
OracleParameterStatus.Success,
OracleParameterStatus.Success
cmd.Parameters.Add(p1);
OracleParameter p2 = new OracleParameter("o_result", OracleDbType.Int32);
p2.Direction = ParameterDirection.Output;
P2.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p2.Value=0;
cmd.Parameters.Add(p2);
int i = 0;
try
conn.Open();
cmd.ExecuteNonQuery();
i =(int) p2.Value;
catch (Exception ex)
finally
conn.Close();
Error:
Execution Failed:ORA-06550:Line 1,Column 7:
PLS-00306:Test parameters when calling the number or types of errors
ORA-06550:Line 1,Column 7:
PL/SQL:Statement ignored
Edited by: user10133982 on Jun 5, 2009 7:48 AM -
How to call oracle stored procedure
how to call oracle stored procedure using
jdevloper.can any one help?
thanks
pullareddyConnection conn =
DriverManager.getConnection("your connect string");
CallableStatement stm=conn.prepareCall( "{?=call getDeptName(?)}");
stm.registerOutParameter(1,OracleTypes.VARCHAR);
int deptno=10;
stm.setInt(2,deptno);
stm.execute();
String dname=stm.getString(1);
stm.close();
conn.close();
getDeptName is a function:
FUNCTION
getDeptName(id IN NUMBER) RETURN VARCHAR2... -
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. -
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? -
Problem in calling Oracle stored procedure from Java.
I am trying to invoke the Oracle stored procedure from Java. The procedure does not take any parameters and does not return anything. If I call it from SQL prompt it is working perfectly. I am calling it in my program as follows.
callable_stmt=con.prepareCall("{call pkg_name.proc_name()}");
callable_stmt.execute();
The problem is the control-of-flow is getting strucked in the second line I wrote. It is not giving any error also.
Please clarify me what's wrong with my code?
Seenu.And how long does the stored procedure take to run from your client machine when running it via sqlplus?
-
Errors in calling Oracle stored procedure using java CallableStatement
Hello,
I have an oracle stored procedure below, it has been tested in PL/SQL without errors. During testing, in_c_file_type="F"; out_n_seqno_freeformat=120139596 and out_n_seqno_commaseprated is null (empty in value column).
When I run the program in Eclipse (windows xp), error messages is below: (It stopped at line 'cstme.execute();' )
Message:ORA-06550: line 1, column 26: PLS-00103: Encountered the symbol "" when expecting one of the following: . ( ) , * @ % & | = - + < / > at in is mod remainder not range rem => .. <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ as between from using || indicator multiset member SUBMULTISET_ The symbol ", was inserted before "" to continue. Error code:6550 SQL statement:65000 {code} Does anyone know what cause the error? It seems like something is missing in the stored procedure. But the stored procedure passes the test in the PL/SQL. The oracla driver I used is Oracle thin driver. Oracle version is 10.2.g Thanks in advance. northcloud {code} create or replace procedure SP_GET_SEQNO_2( in_c_file_type in char, out_n_seqno_freeformat out integer, out_n_seqno_commaseprated out integer) is n_seqno_commaseprated integer; n_seqno_freeformat integer; begin if in_c_file_type ='F' THEN SELECT message_counter.nextval INTO n_seqno_freeformat FROM dual; insert into temp_stroperations (record_id,OUTPUT_STR,INPROCESS_STR) values (n_seqno_freeformat,empty_clob(),empty_clob()); elsif in_c_file_type ='C' THEN SELECT message_counter.nextval INTO n_seqno_commaseprated FROM dual; insert into temp_stroperations (record_id,OUTPUT_STR,INPROCESS_STR) values (n_seqno_commaseprated,empty_clob(),empty_clob()); else SELECT message_counter.nextval INTO n_seqno_freeformat FROM dual; insert into temp_stroperations (record_id,OUTPUT_STR,INPROCESS_STR) values (n_seqno_freeformat,empty_clob(),empty_clob()); SELECT message_counter.nextval INTO n_seqno_commaseprated FROM dual; insert into temp_stroperations (record_id,OUTPUT_STR,INPROCESS_STR) values (n_seqno_commaseprated,empty_clob(),empty_clob()); end if; out_n_seqno_freeformat := n_seqno_freeformat; out_n_seqno_commaseprated := n_seqno_commaseprated; end SP_GET_SEQNO_2; {code} ----- A part of java code I used to call the stored procedure is here. {code} String escapeString = "{call SP_GET_SEQNO_2 (? ? ?)}"; CallableStatement cstme = null; try { cstme = con.prepareCall(escapeString); cstme.setString(1, "F"); cstme.registerOutParameter(2, java.sql.Types.INTEGER); cstme.registerOutParameter(3, java.sql.Types.INTEGER); cstme.execute(); int seqNoFreeformat=0, seqNocommasepreted=0; seqNoFreeformat = cstme.getInt(2); seqNocommasepreted = cstme.getInt(3); System.out.println ("In ConvertXML.processStoredProcedure(), seqNoFreeformat= "+seqNoFreeformat+";seqNocommasepreted="+seqNocommasepreted); } catch (SQLException e) { //System.out.println ("In ConvertXML.processStoredProcedure(), SQLException: "+e); System.err.println("Message:"+e.getMessage()); System.err.println("Error code:"+e.getErrorCode()); System.err.println("SQL statement:"+e.getSQLState()); log.log(Level.INFO, log.getName() + " - SQLException : "+e); } {code}es5f2000 wrote:
jschell wrote:
That works?I dunno. The below definitely works, but like I said, I've only
ever done it with one output parameter (and that has always
been a ResultSet).
String callableQuery = "{?= call my_package.my_call(?, ?)}"
Yes I have done that and at least in terms of my code it wasn't just a result set.
But not with two. -
Calling Oracle stored procedure from java
The following query calls a stored procedure TRANSLATE_ZONEPATH_ID defined in a package MT by the user MTDBA. currentZone is a member variable of the class, and currently has value 1
This query works just fine when I run it from SQLPlus* connected as MTDBA.
But from java, the following piece throws exception saying "invalid column name"
String query = "SELECT MTDBA.MT.TRANSLATE_ZONEPATH_ID('"+currentZone+"') "
+ "FROM DUAL ";
try
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery(query);
if (rst.next())
fullName = rst.getString(1);
stmt.close();
Anyone got any clue ?I always use CallableStatement to execute a stored procedure or function in a database (Oracle).
try this:
<code>
CallableStatement cs = dbConnection.prepareCall("{ ? =
MTDBA.MT.TRANSLATE_ZONEPATH_ID(?)}");
cs.setString(1, currentZone);
cs.registerOutParameter(1, Types.VARCHAR);
cs.executeUpdate();
fullname = cs.getString(1);
cs.close();
</code>
There is also a jdbc forum, where your should post this kind of problem :-)
Hope this help's
ThK -
Calling Oracle Stored Procedure from BC4J JSP App
I am on an extremely tight deadline and am trying to get my JSP application to use an Oracle Stored Procedure. I need to take some input from the user and send these values as parameters. Has anyone worked with Stored Procedures in JDev3.1? Please reply with some sample code if possible.
Thanks.Hi,
Someone posted a similar request the other day. Here is my response to them:
Basically, you need to create a custom method from your JSP's ViewObject, which calls the stored procedure. You can then call the ViewObject's custom method from the JSP client.
Here is how I have done it:
1. Choose the ViewObject that your JSP is based on and choose 'Edit' from the context menu.
2. On the Java tab of the ViewObject wizard, choose Generate Java File checkbox for the View Object Class and click the Finish button. A file is created under the ViewObject node in the Navigator named 'viewobjectImpl.java'.
3. Open the viewobjectImpl.java file in the code editor and create a method to call your stored procedure (see sample code below).
4. Compile the VOImpl.java file.
5. Choose the view object again, and choose Edit again from the context menu.
6. On the Client Methods tab, you should now see your method appear in the Available field. Select it and shuttle it to the Selected field.
7. Click Finish to leave the VO wizard, and rebuild your Business Components project.
8. In your JSP, call the custom method (see sample code below).
sample code for custom method calling a stored procedure from VOImpl.java file:
public int getTotalHits(String mon, String year) {
CallableStatement stmt = null;
int total;
// the call to the PL/SQL stored proc
String totalhits = "{? = call walkthru.total_hits(?,?)}";
// use the AM conxn 2 call storedproc
stmt = getDBTransaction().createCallableStatement(totalhits, 1);
try
// Bind the Statement Parameters and //Execute this Statement
stmt.registerOutParameter(1,Types.INTEGER);
stmt.setString(2,mon); stmt.setString(3,year);
stmt.execute();
total = stmt.getInt(1);
catch (Exception ex)
throw new oracle.jbo.JboException(ex);
finally
try
stmt.close();
catch (Exception nex)
return total;
sample render code for calling custom method from JSP custom bean:
public void render() {
int totalhits;
try
Row[] rows;
// Retrieve all records by default, the qView variable is defined in the base class
qView.setRangeSize(-1);
qView.first();
rows = qView.getAllRowsInRange();
// instantiate a view object for our exported method
// and call the stored procedure to get the total
ViewObject vo = qView.getViewObject();
wtQueryView theView = (wtQueryView) vo;
totalhits = theView.getTotalHits(session.getValue("m").toString(),session.getValue("y").toString());
out.println(totalhits);
} catch(Exception ex)
throw new RuntimeException(ex.getMessage());
} -
Calling Oracle stored procedure from xMII Query Templates.
Hi All,
We have a requirement to call a Oracle stored procedure from xMII, the SP expects some inputs and then it returns multiple rows.
I tried different approches with no results, I remember some posts on the same topic but I could not get in search results.
Looking for some help in this regards
Rupesh.Hi Rupesh Bajaj,
In oracle stored procedure we have to use Packages..if you used packages the u have to assign to some variable.
To calling Stored procedure in Query Template is CALL Testing('[Param.1]','[Param.2]',,:X)
In above line Testing is Stored procedure name and Param.1 is parameters and X is Package.
Thanks
Ravilla Ramesh -
Calling Oracle Stored Procedure through COBOL
I am calling a Oracle Stored Procedure through COBOL program. Here is the procedure that is in Oracle.
PROCEDURE sp_sel_m_event_subs_profile (
eventID IN EventIDTyp,
subscribed IN NUMBER,
v_profileRef OUT profileRefWithDSID_cv
IS
BEGIN
sp_check_event_id(eventID);
OPEN v_profileRef FOR
SELECT
sub.profile_i,
ref.datasource_i,
ref.primary_key_x
FROM
ccf_event_subscribe sub,
ccf_profile_reference ref
WHERE
sub.event_i = eventID
AND
sub.is_subscribed_i = subscribed
AND
sub.profile_i = ref.profile_i;
END sp_sel_m_event_subs_profile ;
So while trying to call this procedure in COBOL program I am getting error as wrong number or types of arguments in call to 'SP_SEL_M_EVENT_SUBS_PROFILE'
Here is the call statement in COBOL. I tried with many other options by adding some more fields but did not work.
EXEC SQL EXECUTE
BEGIN
TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
(:EVENT-I, :SUBSCRIBED);
END;
END-EXEC
Please someone let me know how should I pass arguments EVENT-I and SUBSCRIBED to this Procedure so that I will get PROFILE-I, DATASOURCE-I and PRIMARY-KEY-X
Note: The above procedure is working good by other software. But there is no example as How to use Call statement through COBOL.
ThanksHere is the cobol declaration of each variable.
01 EVENT-I PIC X(06) VALUE SPACES.
01 SUBSCRIBED PIC 9(01) VALUE ZEROS.
01 PROFILE-I PIC X(08) VALUE SPACES.
01 DATA-SRC-I PIC X(08) VALUE SPACES.
01 PRIMARY-KEY-X PIC X(08) VALUE SPACES.
I tried with this layout, but still not working
01 EVENT-I PIC 9(06) VALUE ZEROS.
01 SUBSCRIBED PIC 9(01) VALUE ZEROS.
01 PROFILE-I PIC 9(08) VALUE ZEROS.
01 DATA-SRC-I PIC 9(08) VALUE ZEROS.
01 PRIMARY-KEY-X PIC 9(08) VALUE ZEROS.
Here are some of them I tried.
EXEC SQL EXECUTE
BEGIN
TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
( :EVENT-I
, :SUBSCRIBED
, :PROFILE-I);
END;
END-EXEC
EXEC SQL EXECUTE
BEGIN
TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
( :EVENT-I
, :SUBSCRIBED
, :PROFILE-I
, :DATA-SRC-I
, :PRIMARY-KEY-X);
END;
END-EXEC
EXEC SQL EXECUTE
BEGIN
TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
( :EVENT-I
, :SUBSCRIBED );
END;
END-EXEC
EXEC SQL EXECUTE
BEGIN
TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
( :PROFILE-I
, :DATA-SRC-I
, :PRIMARY-KEY-X);
END;
END-EXEC -
Error Calling Oracle Stored Procedure From Within Report
Hi,
I have a report that calls an oracle stored procedure which returns a ref cursor. The report is working ok in our development environment when called from our development website through .NET.
When the report is moved and accessed from our UAT website we get the following error :-
Failed to open a rowset. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for Oracle Description: One or more errors occurred during processing of command. Failed to open a rowset. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for Oracle Description: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'RHS_GET_CAND_SECTION_REFS' ORA-06550: line 1, column 7: PL/SQL: Statement ignored Native Error: Failed to open a rowset. Error in File C:\WINDOWS\TEMP\temp_d663a952-bef6-4bf7-bf1a-5e288afdb612 {9B6DFB38-A436-4940-9D80-B4C23DFFFF19}.rpt: Failed to open a rowset.
If we open the report manually we are prompted to enter database connection info. If we enter the UAT connection details the report runs ok. If we save the report and try to open it from UAT website through .NET it now opens ok.
If we then move that same report back to the development environment and open from our development website it fails with the same error above.
Both connections are using Microsoft OLE DB drivers and the Oracle databases are the same version (10.2.0.1.0).
Is the connection information being stored in actual report and somehow being used when the report is opened through .NET?
Any help appreciated
Regards
PaulHi,
Please let me know if the issue occurs with the crystal reports designer, if you are facing issues with the .NET application then a need to create a post [here|SAP Crystal Reports, version for Visual Studio;.
Regards,
Hitesh -
Calling Oracle Stored Procedure from Weblogic.
Hi All,
I am using Oracle 11g R2 and weblogic 10.3.5.0
Do you know if it is possible to call a stored procedure from Weblogic.
Basically, what I would like to do is to call the following procedure : EXEC DBMS_SESSION.SET_IDENTIFIER('provider_a') when my application connects to my database, "provider_a" being the user used to connect to the oracle schema.
Thanks.Up !
Thanks. -
How to call Oracle Stored Procedure using EDQ
Can someone tell me how to use Oracle Stored Procedure call in EDQ, sample scripts/steps will be really helpful. Thanks!
It is also possible to do this using a custom processor in EDQ. The processor needs to do something very similar to the external task above (opens a DB connection, authenticates, runs a stored procedure).
If you need this, please talk us through the use case so we can determine if it is the best fit. In some ways, an external task is better as logically a stored procedure call is normally divorced from any process logic in EDQ.
Regards,
Mike -
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.
Maybe you are looking for
-
My trash takes too long or doesn't empty at all.
I've tried the terminal option. I have trash preferences set to Secure Empty Trash everytime I empty the trash. I updated to Mountain Lion two weeks ago, and I've been having trouble with my trash quickly emptying like it used to. SHORT VERISON: I'm
-
Millions of people use this software. How can these problems exist? I am sick of the the compatibility problems and all the other crap. I am sick of the software locking up as soon as it starts up - not responding messages, I have spent hours - inst
-
Report data does not reflect the SQL Query?
Hi, I have a report which does not seem to be processing all records returned from the database. When I run the SQL Query produced by crystal manually against the SQL Server all data is returned correctly in crystal not. Does this mean my links are n
-
in windows2000 and form6i and codepage=ar8mswin1256 (arabic) i use menu module in my main form ,but my menu cannot be right to left i change the direction property but doesnot work. if you know please help me. thanks.
-
App Store on 3GS crashes when trying to install apps after iOS4
Is anyone experiencing this too? Every time it tries to install an app from the 3GS, it bombs out to home. Installing through syncing with iTunes on my iMac works fine however... no more installing free useless apps on the move for me... have to do i