Hello,
I have been studying this also and I think these two statements
                cstmt = conn.prepareCall("{? = call pkg_test.get_chars()}");
                cstmt.registerOutParameter(1, Types.ARRAY, "pkg_test.tab_chars");
should be changed to
                cstmt = conn.prepareCall({? = call pkg_test.get_chars()});
                cstmt.registerOutParameter(1, java.sql.Types.ARRAY);
Hopefully this will help. Please let me know what happens!

Brad Webb


Hooman Ahmadi wrote:

> I'm using Oracle and try to call PLSql function that return table of records
> as a type but I can't use Types.ARRAY to set register my  callable statement
> output. I get an exception with the following text :
>
> PLSql Package :
>
> create or replace package pkg_test as
>   TYPE tab_chars IS TABLE OF varchar2(50) index by binary_integer;
>   function get_chars return tab_chars;
> end;
> /
>
> create or replace package body pkg_test as
> function get_chars return tab_chars is
> x tab_chars;
> begin
> for i in 1..10 loop
>     x(i):= 'Number #'||i;
> end loop;
> end get_chars;
> end;
> /
> ========================================================
> Java Source :
> <%@ page import = "java.sql.*, java.util.*,java.text.*"%>
>
> <%
>                 Connection  conn;
>                 CallableStatement cstmt;
>                 ResultSet result;
>
>                 Driver      dbaseDriver;
>                 String dbDriver = "oracle.jdbc.driver.OracleDriver" ;
>                 String db = "jdbc:oracle:thin:@128.1.1.4:1521:db";
>
>                 try {
>                     dbaseDriver = (java.sql.Driver)Class.forName( dbDriver
> ).newInstance();
>                         out.println(dbaseDriver.getMajorVersion());
>                     conn = java.sql.DriverManager.getConnection (db , "test" , 
>"test");
>                     conn.setAutoCommit (true);
>
>                     cstmt = conn.prepareCall("{? = call pkg_test.get_chars()}");
>                     cstmt.registerOutParameter(1, Types.ARRAY, "pkg_test.tab_chars");
>                     cstmt.executeUpdate();
>
>                     //result = cstmt.getArray(1).getResultSet();
>
>                 }
>                 catch(Exception e){
>                         out.println( e.toString() );
>                 }
> %>
>
> Return Exception :
>
> java.sql.SQLException: Fail to construct descriptor: Unable to resolve type:
> "pkg_test.tab_rows"
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to