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

Home -> Community -> Usenet -> c.d.o.misc -> JDBC handle Oracle Object response

JDBC handle Oracle Object response

From: jacksu <jacksuyu_at_gmail.com>
Date: 30 May 2007 12:03:09 -0700
Message-ID: <1180551789.086664.279980@g4g2000hsf.googlegroups.com>


I have one stored function return Oracle Object back, but I am not sure how to handle it in JDBC.

Here is the SQL script:
drop table TestEmpTable;
create or replace type TestEmpType as object (

	EmpFirstName varchar(20),
	EmpLastName  varchar(20)

);
/

create table TestEmpTable (

	EmpId number,
	EmpDetail TestEmpType

);

create or replace function testGetEmp (emp_id int) return TestEmpType

	is
	emp TestEmpType;
	begin
		select empdetail into emp from testemptable where empid=emp_id;
		return emp;
	end;

/

And here is the code:

CallableStatement stmt = conn.prepareCall("{ ? = call testGetEmp(?)}");
stmt.registerOutParameter(1, OracleTypes.CURSOR);

Got Exception:

ORA-06550: line 1, column 13:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:

PL/SQL: Statement ignored

Any suggestion is highly welcome.

Received on Wed May 30 2007 - 14:03:09 CDT

Original text of this message

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