This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes how to call stored procedure from hibernate that takes array as input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "how to call stored procedure from hibernate that takes array as input" Watch "how to call stored procedure from hibernate that takes array as input" New topic
Author

how to call stored procedure from hibernate that takes array as input

lavnish lalchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 79
Database Code

CREATE TYPE array_table AS TABLE OF VARCHAR2 (50); -- Array of String
CREATE TYPE array_int AS TABLE OF NUMBER; -- Array of integers

procedure which takes an array as an input parameter and returns an array as its OUT parameter.
below procedure has 2 parameters -
an array of String as its IN parameter – p_array
an array of Integers as OUT parameter – p_arr_int
CREATE OR REPLACE PROCEDURE SchemaName.proc1 (p_array IN array_table,
len OUT NUMBER,
p_arr_int OUT array_int)
AS
v_count NUMBER;
BEGIN
p_arr_int := NEW array_int ();
p_arr_int.EXTEND (10);
len := p_array.COUNT;
v_count := 0;
FOR i IN 1 .. p_array.COUNT
LOOP
DBMS_OUTPUT.put_line (p_array (i));
p_arr_int (i) := v_count;
v_count := v_count + 1;
END LOOP;
END;
/


how can i call this from hibernate using ( i ) Native SQL ( ii ) Named procedure

lavnish.blogspot.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call stored procedure from hibernate that takes array as input
 
Similar Threads
Pass Array From to Java to Stored Procedure
Need Help with pl/sql (Compilation Error)
Passing array input in procedure - thin driver
Stored procedure which returns array
Calling stored procedure problems