Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> calling oracle stored procedures/functions from java (JDBC)
I'm a fairly experienced java developer who is trying to learn how to
call some stored procedures in an Oracle database. I'm having trouble
figuring out how to pass information into a stored procedure.
The database has a packaged defined something like this:
CREATE OR REPLACE PACKAGE Some_Pak AS
TYPE gtyp_order_record IS RECORD(
g_whs WHSLOC.Whs%TYPE, --VARCHAR2(2)
g_ship_lab SHPPAL.ship_lab%TYPE, --VARCHAR2(10)
... additional fields removed to save space );
TYPE gtyp_ref_order_record IS REF CURSOR RETURN gtyp_order_record;
PROCEDURE StartOrder(
p_order_record_i IN gtyp_order_record);
END Some_Pak;
How would I call the StartOrder procedure from a java client program connected via the JDBC thin driver?
I'm thinking it would be something like this:
CallableStatement callStartOrder = null;
try {
callStartOrder = conn.prepareCall("begin Some_Pak.StartOrder( ? );
end;");
callStartOrder.registerInParameter(1, OracleTypes.CURSOR);
...
callStartOrder.execute();
If that is correct, how do I create a "java version" of gtyp_order_record, and how do I pass it to the StartOrder procedure? Received on Thu Sep 08 2005 - 11:17:11 CDT