Passing of ResultSet to Stored Procedure(Oracle 8i) from Java
My requirement is such that I want to send a resultset to a stored procedure(In oracle8i). Through Java API's.
The input parameter to the PLSQL is a ref cursor.
I am trying to send the resultSet using CallableStatement of java but it is throwing an Inavlid column type error.
So firstly is it possible to send a resultset to Oracle through java. If yes, then please suggest me as to how it can be done?
Rajeev,
I remember seeing something on Oracle's MetaLink Web site, saying that this is not supported. Sorry, but I can't give you any more details -- I don't remember (and I'm too lazy to look :-)
I also think that I found that MetaLink article via a posting to one of these (i.e. Oracle) forums. Perhaps a search of the forum archives will help?
Good Luck,
Avi.
Similar Messages
-
Calling stored procedures in Sybase from java
Hi,
I am using the following stored procedure in Sybase
use xyzdb
go
-- drop procedure if it already exist
if object_id('up_name_select') is not null
begin
drop procedure up_name_select
end
go
create procedure up_name_select
@zid numeric(7,0),
@firstname char(40),
@lastname char(40)
as
select zid,
firstname,
lastname
from name
where zid = @zid or
(lastname like @lastname or firstname like @firstname)
go
-- update documentation records in object_docs
delete object_docs
from object_docs
where object_name = "up_name_select"
go
insert into object_docs values("up_name_select","Selects records from the name table based upon the values of the input parameters.")
go
-- update documentation records in column_docs
delete column_docs
from column_docs
where object_name = "up_name_select"
go
insert into column_docs values("up_name_select","@zid","System generated ID for an individual contact.")
insert into column_docs values("up_name_select","@firstname","First name of the contact. SQL wild card characters are accepted.")
insert into column_docs values("up_name_select","@lastname","Last name of the contact. SQL wild card characters are accepted.")
go
-- print success message and grant permissions
if object_id('up_name_select') is not null
begin
print "Procedure up_name_select created."
grant execute on up_name_select to developer_role
end
go
This stored procedure selects the values from the table "name" for a given where condition (if I am not wrong).
Can any one give me sample java code to select the records from the table "name" for a given zid.
Thankyou in advance.
Regards
sgatl2calling stored procedures from java
here is the sample code
CallableStatement cs = con.prepareCall("{call selectlogin (?)}");
cs.setString (1, "value");
ResultSet rs = cs.executeQuery ();
while (rs.next ())
//your code for display
} more on gooooooogle
http://www.google.com/search?q=calling+stored+procedures+from+java+with+sample+example&client=netscape-pp&rls=com.netscape:en-US -
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. -
Can a Stored Procedure be called from a Rule (not using Scripted JDBC Adap)
Hello smart people,
Question: Can a stored procedure be called from a Rule without using the Scripted JDBC Resource Adapter?
What's Desired: The project has very strong sql developers and average at best Java developers. We have been successful at implementing the scripted JDBC Resource Adapter which makes use of Java Bean shells. The custom Java Bean shell contains code that calls a stored procedure. We are cool with that process.
However we would like to be able to set up a Rule that calls a Stored Procedure without jumping thru the Java Bean Shell layer. The Stored Procedures we will be developing will not access the tables in the Waveset database. Instead the Stored Procedures will be accessing custom tables in a custom database. The custom DBase will be housed on the same dBase server as the Waveset database.
Environment: Identity Manager 7.1. Oracle 10i, and Unix OS.
It seems to me that this task is possible, but the posts in this forum make it sound like perhaps it is not.
Do any of you smart people agree that it should be possible or better yet has anyone implemented such an approach?
Thanks.We did this by putting all of the JDBC calls into a Java class, then instantiated that class and called the methods from within a rule. An example of a rule we used is this:
<Rule authType='UserMembersRule' name='List UserType'>
<block>
<defvar name='adapter'>
<new class='com.waveset.adapter.ScriptedJdbcResourceAdapter'/>
</defvar>
<invoke name='setResource'>
<ref>adapter</ref>
<invoke name='getObject' class='com.waveset.ui.FormUtil'>
<ref>context</ref>
<s>Resource</s>
<s>Banner</s>
</invoke>
</invoke>
<defvar name='jdbcHelper'>
<new class='edu.bates.JDBCHelper'>
<invoke name='getConnection'>
<ref>adapter</ref>
</invoke>
</new>
</defvar>
<defvar name='userList'>
<new class='java.util.ArrayList'/>
</defvar>
<invoke name='addQueryToList'>
<ref>jdbcHelper</ref>
<s>SQL QUERY HERE</s>
<ref>userList</ref>
</invoke>
<ref>userList</ref>
</block>
<MemberObjectGroups>
<ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
</MemberObjectGroups>
</Rule> -
Problem Calling MaxDB stored procedure with output from MII Query template
Hi,
I am using Max DB Database studio to write stored procedure, I am calling stored procedure from MII Query using CALL statement.
Can anyone guide me how to pass output values of stored procedure.
Examlpe::
call ProcName('[Param.1]','[Param.2]','[Param.3]','[Param.4]','[Param.5]', :isSuccess, :Trace)
In the above line of code I am not able to get the output values of stored procedure that is isSuccess and Trace values in Query template when executed. But same thing I get when executed in Database studio.
How do I call with outputs for any stored procedure in MII.
Any help would be appriciated.
Thanks,
PadmaMy call statement is like this
call RESULTDATA_INSERT('[Param.1]','[Param.2]','[Param.3]', :isSuccess, :Trace)
I am able to insert record in DB, But I am not getting output values in Query template.I have done this in Fixed Query, when I execute it throws me "Fatal error as Loaded content empty".
I tried giving select below call but it dont work.
Regards,
Rao -
Without calling stored procedure or functions from database
Hi,
I am using Jdeveloper 11.1.1.5.0.
=>How to do PL/SQL procedures and functions in ADF without calling stored procedure or function from DB?S, PL/SQL procedures and functions are done in Application Module class or in managed bean..By calling the stored procedures or functions from DB.
But I am asking how to do if DB doesn't have any procedures,triggers and functions. -
Problem calling oracle SP from Java
Hi I am trying to call an oracle SP from Java program and getting the error code 17060. Below is my code:
Oracle SP:
create or replace type item as object (itemnumber varchar2(9),itemdesc varchar2(35));
create or replace type uom as object (prodUOM varchar2(18), ratioDen NUMBER(1));
CREATE OR REPLACE TYPE uom_Arr aS VARRAY(100) OF uom;
create or replace package test_pkg_xml is
procedure test_sp_xml (item_rec item,
uom_tbl uom_arr);
end test_pkg_xml;
create or replace package body test_pkg_xml is
procedure test_sp_xml (item_rec item,
uom_tbl uom_arr)
is
begin
null;
end;
end test_pkg_xml;
Java Code
public class item implements SQLData {
private String sql_type;
public String itemnumber ;
public String itemdesc ;
public String getSQLTypeName() throws SQLException { return sql_type; }
public void readSQL(SQLInput stream, String typeName)throws SQLException
sql_type = typeName;
itemnumber = stream.readString();
itemdesc = stream.readString();
public void writeSQL(SQLOutput stream) throws SQLException
System.out.println("in write sql");
stream.writeString (itemnumber);
stream.writeString (itemdesc);
package com.tgt.dstb.dwm.dstbtowm.dao;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.sql.Connection;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Types;
import java.sql.SQLException;
import java.util.Map;
import java.util.Hashtable;
public class TestDOM
public static void test(Connection conn) throws Exception
item obj1 = new item();
Obj2 obj2 = new Obj2();
Obj2[] obj3 = {new Obj2(), new Obj2()};
String sql = "call " + "test_pkg_xml.test_sp_xml(?,?)";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse( "item.xml" );
Element itemMaster = document.getDocumentElement();
NodeList itemNumber = itemMaster.getElementsByTagName("itemNumber");
NodeList itemDesc = itemMaster.getElementsByTagName("itemDesc");
System.out.println("Item = ");
String itmname = DOMUtil.getSimpleElementText( itemMaster, "itemNumber" );
String itmdesc = DOMUtil.getSimpleElementText( itemMaster, "itemDesc" );
obj1.itemnumber = itmname;
obj1.itemdesc = itmdesc;
System.out.println("itmname = " + obj1.itemnumber );
System.out.println("itmdesc = " + obj1.itemdesc );
NodeList uoms = itemMaster.getElementsByTagName("uoms");
NodeList uom = itemMaster.getElementsByTagName("uom");
System.out.println("uom = ");
for( int i=0; i<uom.getLength(); i++ ) {
String itmprodUOM = DOMUtil.getSimpleElementText(
(Element)uom.item(i),"prodUOM" );
obj3.prodUOM = itmprodUOM;
String itmratioDen = DOMUtil.getSimpleElementText(
(Element)uom.item(i), "ratioDen" );
obj3[i].ratioDen = itmratioDen;
System.out.println( " "+ itmprodUOM +" ("+itmratioDen+")" );
try
Hashtable map = new Hashtable();
map.put ("item", Class.forName ("com.tgt.dstb.dwm.dstbtowm.dao.item"));
conn.setTypeMap(map);
System.out.println("here 11111 ");
CallableStatement stmt = conn.prepareCall("call test_pkg_xml.test_sp_xml(?,?)");
System.out.println("here 2 ");
stmt.setObject(1,obj1);
System.out.println("here 3 ");
stmt.setObject(2,obj3);
System.out.println("here 4 ");
stmt.execute();
System.out.println("here 5 ");
}catch (SQLException e)
System.out.println("exception :"+e.getErrorCode());
Can you please point out where I might be going wrong with the code? Any help would be greatly appreciated.
PS : I am getting the error 17060 after the stmt : System.out.println("here 2 ");
Thanks,
NitinAvi, I changed my code to:
package com.tgt.dstb.dwm.dstbtowm.dao;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.sql.Connection;
//import java.sql.CallableStatement;
import java.sql.*;
//import java.util.Map;
//import java.util.Hashtable;
import oracle.sql.ArrayDescriptor;
import oracle.sql.*;
import oracle.jdbc.*;
public class TestDOM
public static void test(Connection conn) throws Exception
item obj1 = new item();
Obj2 obj2 = new Obj2();
Obj2[] obj3 = {new Obj2(), new Obj2()};
String sql = " call test_pkg_xml.test_sp_xml(?,?)";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse( "item.xml" );
Element itemMaster = document.getDocumentElement();
NodeList itemNumber = itemMaster.getElementsByTagName("itemNumber");
NodeList itemDesc = itemMaster.getElementsByTagName("itemDesc");
System.out.println("Item = ");
String itmname = DOMUtil.getSimpleElementText( itemMaster, "itemNumber" );
String itmdesc = DOMUtil.getSimpleElementText( itemMaster, "itemDesc" );
obj1.itemnumber = itmname;
obj1.itemdesc = itmdesc;
System.out.println("itmname = " + obj1.itemnumber );
System.out.println("itmdesc = " + obj1.itemdesc );
NodeList uoms = itemMaster.getElementsByTagName("uoms");
NodeList uom = itemMaster.getElementsByTagName("uom");
System.out.println("uom = ");
for( int i=0; i<uom.getLength(); i++ ) {
String itmprodUOM = DOMUtil.getSimpleElementText(
(Element)uom.item(i),"prodUOM" );
obj3.prodUOM = itmprodUOM;
String itmratioDen = DOMUtil.getSimpleElementText(
(Element)uom.item(i), "ratioDen" );
obj3[i].ratioDen = Integer.parseInt(itmratioDen);
System.out.println( " "+ itmprodUOM +" ("+itmratioDen+")" );
try
System.out.println("here 1 ");
OracleCallableStatement stmt = (OracleCallableStatement)
conn.prepareCall("BEGIN test_pkg_xml.test_sp_xml(?,?); END;");
System.out.println("here 1.1 ");
System.out.println("here 1.2 ");
ArrayDescriptor desc1 = ArrayDescriptor.createDescriptor("UOM_ARR", conn);
ARRAY array_to_pass1 = new ARRAY(desc1, conn, obj3);
System.out.println("here 2 ");
stmt.setObject(1,obj1,OracleTypes.STRUCT);
System.out.println("here 3 ");
stmt.setArray(2,array_to_pass1);
System.out.println("here 4 ");
stmt.execute();
System.out.println("here 5 ");
}catch (Exception e)
e.printStackTrace();
However, now I the code is printing
"here 1 "
and then giving
"[1/4/07 11:37:28:133 CST] 00000036 SystemErr R java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcCallableStatement"
at "OracleCallableStatement stmt = (OracleCallableStatement)
conn.prepareCall("BEGIN test_pkg_xml.test_sp_xml(?,?); END;");"
statement.
I am using Rational App Developer Version 6.0.1 and getting a connection using
the below code:
DataSource dataSource=null ;
Context jndiContext = new InitialContext();
dataSource =
(DataSource)jndiContext.lookup("java:comp/env/jdbc/DWM3DDS");
Connection wsConn = dataSource.getConnection();
Looks like this exception occurs when I am casting java.sql.Connection object to OracleCallableStatement. Do you have any idea why this might be occuring? Have you encountered this kind of a problem?
Thanks,
Nitin -
Calling a stored procedure of oracle 8 from java
hello,
i made a stored procedure as below in 1 program :
String url = "jdbc:odbc:rjc1";
Connection con = DriverManager.getConnection(url,"scott","tiger");
Statement stmt = con.createStatement();
String createProc =
"Create procedure sp1 as select * from items order by iprice desc";
stmt.executeUpdate(createProc);
in other program i have a code as below to retrieve the result of stored procedure :
CallableStatement cs = con.prepareCall("{call sp2}");
ResultSet rs = cs.executeQuery();
the error message that i get is SCOTT.SP1 is invalid.
any help would be great.
thanx in advance.hello :
1. i created procedure sp2 and called sp2.
2. sql statement that we created works fine on oracle - sql i have tested the same.
3. i did not create a separte userid or password in oracle i was using test account scott which is already present in oracle.
any thoughts please. -
How to call stored procedure having parameter as oracle type from java???
Hello,
I have created following type & stored procedure in oracle. How can i call this stored procedure from my java class?
I want to pass 2d array to this procedure.
CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100));
CREATE OR REPLACE TYPE tbl_survey AS VARRAY(100) OF type_survey;
CREATE OR REPLACE PROCEDURE INSERTEMP (pp in tbl_survey)
IS
BEGIN
FOR I IN pp.FIRST .. pp.LAST
LOOP
INSERT INTO SURVEY (id) VALUES (pp(I).emp_id);
END LOOP;
END;
/CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100));
CREATE OR REPLACE TYPE tbl_survey AS VARRAY(100) OF type_survey;
CREATE OR REPLACE PROCEDURE APP_DATA.INSERTEMP (pp in tbl_survey,result out varchar)
IS
BEGIN
FOR I IN pp.FIRST .. pp.LAST
LOOP
INSERT INTO SURVEY (id) VALUES (pp(I).emp_id);
END LOOP;
result:='done';
END;
public static void passArray() throws SQLException
Connection conn=null;
try{
conn=getOracleConnection();//this method returns connection object
catch (Exception e)
e.printStackTrace();
String[][] val=new String[2][2];
* val[0][0]="1";*
* val[0][1]="aaa";*
* val[1][0]="2";*
* val[1][0]="bbb";*
StructDescriptor desc1=StructDescriptor.createDescriptor("TYPE_SURVEY",conn);
STRUCT p1struct1 = new STRUCT(desc1,conn,_val_); *//showing error at this line*
ArrayDescriptor arraydesc = ArrayDescriptor.createDescriptor("TBL_SURVEY",conn);
ARRAY array = new ARRAY(arraydesc,conn,*p1struct1*);
CallableStatement cstmt = conn.prepareCall("{ call INSERTEMP(?,?)}");
cstmt.setObject(1,array);
cstmt.registerOutParameter(2, OracleTypes.VARCHAR);
cstmt.execute();
String res=cstmt.getString(2);
System.out.println(res);
in the above java code, I have passed 2d array of string to STRUCT constructor and passed STRUCT object i.e. p1struct1 to ARRAY constructor. is it correct? that means @bottom line, I want to pass val array to my stored porcedure. How can i do this? above code is showing following error......
Exception in thread "main" java.sql.SQLException: Fail to convert to internal representation: [Ljava.lang.String;@146c1d4
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.oracore.OracleTypeNUMBER.toNUMBER(OracleTypeNUMBER.java:540)
at oracle.jdbc.oracore.OracleTypeNUMBER.toDatum(OracleTypeNUMBER.java:54)
at oracle.sql.StructDescriptor.toOracleArray(StructDescriptor.java:717)
at oracle.sql.StructDescriptor.toArray(StructDescriptor.java:1375)
at oracle.sql.STRUCT.<init>(STRUCT.java:159)
at com.flologic.ArrayDemo.passArray(ArrayDemo.java:29)
at com.flologic.ArrayDemo.main(ArrayDemo.java:57) -
Pass parameter values for stored procedure in URL, possible?
Hi, everyone, Our system is Apex4.0.2 in Linux CentOS 5 on Oracle 11GR2, here is the procedure:
create or replace procedure test_public(Cust_id integer)
is
begin
owa_util.mime_header( 'text/xml', FALSE );
owa_util.mime_header( 'application/octet', FALSE );
-- Close the HTTP Header
owa_util.http_header_close;
htp.p(DBMS_XMLGEN.getXML('SELECT * FROM demo_orders where customer_id='|| cust_ID));
end;
+/+
the call to the stored procedure is SUCCESSFUL when Test_public has no parameters, like:
http://myserver/apex/myschema.test_public (OK)
the question is : I want to pass 3 parameters into my stored procedure(on production procedure), just don't know How?
Any suggestions are greatly appreciatedThanks, Vee, definitely working, I do appreciate your help.
I have to use Stored Procedure in Apex: my goal is to setup RESTful web service for IOS and Andriod alike, but APEX RESTful only supports SQL Report ( the RESTFUL check Box goes away with PL/SQL returning Query report, much to my surprise), I need expose some data and the same time I need insert/update some data when the client consumes our data, a PL/SQL based Report will do, but as I found out only simple SQL report has RESTful service, a Before REGION Process will do too, but web service connection WON'T fire that process (normal page display will fire the process) so I'm out of option.... Man I wish APEX REST is not so so basic.... -
I want to execute a stored procedure using ssis.But the problem I am having is that there is a table with 200 rows with only
single column.Now i want to execute stored procedure using value one by one from table .once the stored procedure is executed with top value from table i also want to delete that topmost column value and execute with next table value.and store the result in
text file.
please help me..or provide a package.If you want to do it in SSIS, a way to do this is by using For Each Loop as mentioned above.
Create 1 OBJECT type variable (list of values) and one STRING type variable (one value at a time)
Use EXE SQL Task with ResultSet = FULL RESULT SET and query = SELECT COL FROM TABLE ORDER BY COL ASC...output this to the OBJECT type variable
Next, a For Each loop container with Foreach ADO Enumerator, ADO object source variable = Object type variable and map that to String type variable with index = 0.
Within your for each loop container, select another EXEC SQL Task and pass in an input parameter (the String type variable) and query = EXEC PROC ? -- WHERE ? = String type variable.
This will execute your store procedure just for that one value out of the whole list.
Now within the same For Each loop, select another EXEC SQL Task and again pass in an input parameter (the same String type variable) and query = DELETE FROM TABLE WHERE COL = ? -- WHERE ? = the current value
The above process should A) get the list of values from the table B) pick one value at a time and execute the proc and delete and right after delete that value from the table.
Hope this helps.
-- some further investigation/tweaking may require but it should help you get started. -
How to pass multiple records to stored procedure??
Hi,
Can a web application call stored procedure (could be JDBC call)with resultset as it's input parameter? I'm sure there has to be some way to deal with this and I will appreciate your feedback. The web page has multiple records in tabular format and submit should save each record. Is it possible to pass all the records at once through resultset instead of calling stored procedure for each one?
I'm thinking to use cursor variable as a input parameter of a stored procedure. But I'm not sure whether stored procedure can open/fetch this cursor variable into record structure. Here's the sample example of cursor variable definition.
TYPE EmpRecTyp IS RECORD (
emp_id NUMBER(4),
emp_name VARCHAR2(10),
job_title VARCHAR2(9),
dept_name VARCHAR2(14),
dept_loc VARCHAR2(13));
TYPE EmpCurTyp IS REF CURSOR RETURN EmpRecTyp;
PROCEDURE save_staff (emp_cv IN EmpCurTyp);
Thanks for your help.
HemalYou can't pass in a result set, but you can make each parameter a PL/SQL table.
Since you also can't pass in a PL/SQL table of records, I typically create a parameter for each "field", with each parameter containing one or more elements. You can then use bulk binding to process the tables in one statement. -
Passing blank parameter to stored procedures/function
Hi all,
When I pass blank value ('') to a VARCHAR2 parameter in a stored procedures/function it reads the parameter as NULL, I try to use DEFAULT keyword in the parameter declaration, but it does not work. How can I make the sp/func read the paramater as '' ?
Thanks in advance
SetyaThis is a fundamental quirk of Oracle - it treats '' (empty string) as if it were null:
SQL> SELECT case when '' is null then 'EMPTY STRING IS NULL' else 'EMPTY STRING IS NOT NULL' end
2 FROM dual;
CASEWHEN''ISNULLTHEN'EMP
EMPTY STRING IS NULL
SQL> So what is it you want to do that you can do with an empty string but not with a null?
Regards, APC -
Passing ARRAY object to stored procedure problem
I've created a stored procedure that accepts as a parameter a
database type
that I have defined as a VARRAY. (create type XXX)
When I attempt to pass an ARRAY object to this stored procedure
through JDBC
(Thin-client driver) I recieve the Oracle internal error ORA-
00600 and the
first "parameter" is [12760].
Has anyone else attempted the same sort of thing w/ success?
I am including the Java source code to help the investigation
private void chad(int[] railcarIds) throws NonFatalDBException,
FatalDBException {
CallableStatement theStatement = null;
try {
theStatement = this.getDatabaseConnection().prepareCall("{call
RomsRepairPackage.chad(?)} ");
// create an ARRAY object to send to the procedure
ArrayDescriptor ad =
ArrayDescriptor.createDescriptor("RAILCARIDVARRAYTYPE",
this.getDatabaseConnection());
ARRAY theArray = new ARRAY(ad, this.getDatabaseConnection(),
railcarIds);
// set the input parameter which is the array of railcar ids
((OracleCallableStatement)theStatement).setARRAY(1, theArray);
theStatement.execute();
theStatement.close();
} catch (SQLException sqle) {
System.out.println("ouch");
Thank you for any help,
Chad Sheley
Senior Consultant
Cap Gemini
Des Moines, IA
nullHi
Can u plzz help me as to how did u write the procedure to take arrays as input.I also have to write aprocedure that takes arrays and returns arrays.Plzz can u give me a working sample as I have not found any help anywhere
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Chad Sheley ([email protected]):
I've created a stored procedure that accepts as a parameter a
database type
that I have defined as a VARRAY. (create type XXX)
When I attempt to pass an ARRAY object to this stored procedure
through JDBC
(Thin-client driver) I recieve the Oracle internal error ORA-
00600 and the
first "parameter" is [12760].
Has anyone else attempted the same sort of thing w/ success?
I am including the Java source code to help the investigation
private void chad(int[] railcarIds) throws NonFatalDBException,
FatalDBException {
CallableStatement theStatement = null;
try {
theStatement = this.getDatabaseConnection().prepareCall("{call
RomsRepairPackage.chad(?)} ");
// create an ARRAY object to send to the procedure
ArrayDescriptor ad =
ArrayDescriptor.createDescriptor("RAILCARIDVARRAYTYPE",
this.getDatabaseConnection());
ARRAY theArray = new ARRAY(ad, this.getDatabaseConnection(),
railcarIds);
// set the input parameter which is the array of railcar ids
((OracleCallableStatement)theStatement).setARRAY(1, theArray);
theStatement.execute();
theStatement.close();
} catch (SQLException sqle) {
System.out.println("ouch");
Thank you for any help,
Chad Sheley
Senior Consultant
Cap Gemini
Des Moines, IA<HR></BLOCKQUOTE>
null -
How to pass FORM values to stored procedures !!!
Hello guys,
I developed a form, and when
I click SAVE, i need to pass the form
values(like deptno,dname) to a stored procedure !!!
Please do let know, what should be the
approach, I have done this is Dev2000,
but how to do in Portal !!!
Thanks for your time !!!
A.Kishore
nullHi,
Take a look at this:
http://technet.oracle.com:89/ubb/Forum81/HTML/000103.html
Also, you can search through the archive for more topics.
Thanks,
Dmitry
Maybe you are looking for
-
Does iTunes have a default password for initial encrypted backups?
I have an iPhone that was connected to iTunes for the first time today. It is a company device and IT has set a policy to require backups to be encrypted. When I first plugged the phone in, iTunes automatically did a backup as it had never seen the
-
Mail & Yahoo: how can I get "Sent" folder to synch, like the "Inbox"?
Happy to be back in Mac, after 15yrs of corporate MS boredom. And TIA for your help with my little 'set-up' problem. I'd like that my "Sent" mailbox (in Mail.app) mimic the functionality of my "Inbox" mailbox, as relates to my Yahoo!Plus email accoun
-
Scanning not working b/c ICMP or SNMP is blocked?
I'm having a terrible time getting scanning over the network functioning on 10.6.1 with my Brother printer/scanner. (Printing works fine.) Because scanning works over USB, I suspected something was being blocked by the Mac. I turned of the firewall a
-
Tax Reporter: magnetic media files in Excel format
Most of the state agencies websites require a "Microsoft Excel Comma Separated Values File" or a regular Excel file for SUTA reports to be able to upload them online. Is it possible to generate the magnetic media files from Tax Reporter in one of the
-
Iphone heaven, ringtone ****!
How can the UK users of the world get more ringtones than the standard? We can't create a ringtone in Itunes UK and I don't seem to have this Garage Band business even though my software is the latest!? Help!