Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Calling Oracle function from Java problem

Re: Calling Oracle function from Java problem

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 01 May 1999 12:07:08 GMT
Message-ID: <372bee53.5320109@192.86.155.100>


A copy of this was sent to odessa7_at_my-dejanews.com (if that email address didn't require changing) On Fri, 30 Apr 1999 20:56:01 GMT, you wrote:

>Here is my code colling a function from Oracle 8.0.3 package. The function
>returns a cursor type. It compiles OK, but at runtime fails with
>error 'java.sql.SQLException: Parameter Type Conflict' at the line with
><****************************
>
>String driver_class = "oracle.jdbc.driver.OracleDriver"; String
>connect_string = "jdbc:oracle:thin:@192.168.1.19:1521:netc"; String query =
>"begin :1 := pg_search_catalog.search_catalog(:2); end;";
>
> Connection conn;
> Class.forName(driver_class);
> DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver ());
> conn= DriverManager.getConnection(connect_string, "scott", "tiger");
>
>
> CallableStatement cstmt = conn.prepareCall(query);
> cstmt.setString(1, "wire");

                         ^^^ shouldn't that be 2?  you are binding "wire" to the
cursor variable this way.

> cstmt.registerOutParameter(1,OracleTypes.CURSOR);
><****************************
>
> cstmt.execute();
> .......
>
>
>Here is type defs from Oracle package:
>TYPE GeneralSearchReturnType IS RECORD ( item_no CHAR(9));
>TYPE GeneralSearchCurTyp IS REF CURSOR RETURN GeneralSearchReturnType;
>FUNCTION search_catalog(search_str VARCHAR2 ) RETURN GeneralSearchCurTyp;
>
>
>
>
>Why is there a type mismatch. Thanx
>
>Leonid
>leonid_at_russiantreasure.com
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sat May 01 1999 - 07:07:08 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US