I have a oracle stored function which returns an integer. Something similar to
Code:
CREATE OR REPLACE FUNCTION SF_SAMPLE
(days IN INTEGER)
RETURN INTEGER
AS
BEGIN
RETURN days;
END SF_SAMPLE;
/
If I get the connection from the session and execute it the jdbc style, i get the return value. but the session.connection() is deprecated and i don't want to use it.
I am trying to execute the following way from my hibernate dao.
Code:
SQLQuery query = super.getSession().createSQLQuery("{ ? = call SF_SAMPLE(:days) }");
query.setParameter("days", _days );
int i = query.executeUpdate();
First it would not execute unless I set the parameter for the return value too.
Second, I don't know how to get the return value back. I have looked up the documentation but couldn't find much.
I know that its something I must be doing wrong, but don't know what it is. Please help.
Thanks in Advance.