Output parameter in java stored procedure
441437Apr 6 2005 — edited Apr 7 2005How are you All
I want to ask about out put parameter in java stored procedure
and how we can passing the out put parameter from java method to
oracle stored procedure then return this out put to the application.
Another question How we can writing more code in java stored procedure
other than calling Java method.
================================================================================
Sample code is
JAVA CODE IS
=============
import sqlj.runtime.*;
import java.sql.SQLException;
import oracle.sqlj.runtime.Oracle;
import java.sql.*;
class TmpDML
{
//Insert method
public static void insert(oracle.sql.NUMBER radius
,oracle.sql.NUMBER area
,oracle.sql.NUMBER id) throws SQLException
//third parameter must be out put parameter
{
try
{
#sql {insert into tmp(f1,f2) values(:radius, :area) returning id into :out id};
}
catch (SQLException e){System.err.println(e.getMessage());}
}// end insert method
}// end class
========================================================================================================
ORACLE CODE IS
===============
CREATE OR REPLACE PROCEDURE RAISE_SALARY
(PI_RADIUS NUMBER
,PI_AREA NUMBER
,PO_ID NUMBER)
/*third parameter must be out put*/
AS LANGUAGE JAVA NAME 'TmpDML.insert(oracle.sql.NUMBER, oracle.sql.NUMBER, oracle.sql.NUMBER )';
========================================================================================================
Thank you