3
甲骨文對象我有這樣的Oracle對象:如何映射JDBC
CREATE OR REPLACE type employee_obj
AS
object (
id NUMBER(10) ,
...
)
存儲過程
function get_employee_obj() return employee_obj is
l_employee employee_obj;
begin
...
return l_employee;
end;
,我需要從Java代碼調用它:
final String QUERY = "begin ? := GET_EMPLOYEE_OBJ(); end;";
Connection connection = getConnection();
CallableStatement stmt = connection.prepareCall(QUERY);
stmt.registerOutParameter(1, <WHAT TO PUT HERE>);
stmt.execute();
ResultSet rs = (ResultSet) stmt.getObject(1);
...
什麼SQL或Oracle類型我需要指定爲registerOutParameter參數從存儲函數讀取對象?我嘗試了幾次,但總是得到了PLS-00382:表達式是錯誤的類型錯誤。謝謝!
也許這將有助於與「se從雙重「get_employee_obj()」:http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/ObjectOracleSample/ObjectOracleSample.java.html – 2010-08-06 09:52:37
http://download.oracle.com/文檔/ CD/B19306_01/java.102/b14355/oraoot.htm#g1104293 – 2010-08-06 18:41:13