I have the following function:
CREATE OR REPLACE FUNCTION FUNCTEST (
val1 IN OUT NUMBER, val2 IN OUT NUMBER)
RETURN NUMBER
AS
BEGIN
val1 := val1 + 1000;
val2 := val2 + 5000;
RETURN 0;
END FUNCTEST;
and the following java code to call the function above:
Connection con;
String Url = "jdbc:odbc:myDataSource";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e) {
}
try {
con = DriverManager.getConnection (Url, "user", "pwd");
}
catch (SQLException e) {
}
CallableStatement cstmt = (CallableStatement)con.prepareCall("begin FUNCTEST(?,?); end;");
cstmt.setInt (1, 1);
cstmt.setInt (2, 5);
cstmt.registerOutParameter (1, Types.INTEGER);
cstmt.registerOutParameter (2, Types.INTEGER);
cstmt.execute ();
Double d1 = (Double)((CallableStatement)cstmt).getObject(1);
Double d2 = (Double)((CallableStatement)cstmt).getObject(2);
when I try to execute the java code I got the error:
"java.sql.SQLException: [Oracle][ODBC Oracle Driver]Error in assignment" when I execute the line cstmt.execute ();
What Im doing wrong?
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks