Jagadeesh
Jagadeesh

Reputation: 2800

How to call store procedure when it has out parameter in oracle?

I have one store procedure which has 3 input parameters and one out parameter named

'TEST(name1 IN VARCHAR2, name2 IN VARCHAR2, name3 IN VARCHAR2, result OUT VARCHAR2)'

How can i call this stored procedure using Hibernate Criteria API. My configuration as follows: Hibernate 3.x, and Oracle.

Upvotes: 0

Views: 453

Answers (1)

APC
APC

Reputation: 146349

The Criteria API does some fancy stuff but still basically just assembles and executes SQL queries.

Well, we can't use procedures in SQL, only functions. So what you need to do is re-write your procedure so it has a function's signature instead. Something like:

create or replace function test 
    (name1 IN VARCHAR2, name2 IN VARCHAR2, name3 IN VARCHAR2)
    return varchar2
is
    result varchar2(30);  -- or whatever length it needs 
begin
    --  do your stuff here, populating RESULT as before.
    return result;
end;

Upvotes: 0

Related Questions