begin ? := 함수명(); end;가 중요!!!
CREATE OR REPLACE FUNCTION LinkBms_Facility
(
v_JobTable IN varchar2 ,v_Action IN char ,v_FacilId IN varchar2
,v_LinkKeyOld IN varchar2 ,v_LinkKeyNew IN varchar2 ,v_Result OUT varchar2
) RETURN number
IS
…..
BEGIN
…..
END;
public int LinkBMSFacil(Connection con, String v_JobTable, String v_Action, String v_FacilId, String v_LinkKeyOld, String v_LinkKeyNew, StringBuffer v_Result) throws SQLException
{
CallableStatement cstmt = null;
int result = -1;
try
{
cstmt = con.prepareCall(“begin ? := rmbs.LinkBms_Facility(?, ?, ?, ?, ?, ?); end;”);
cstmt.registerOutParameter(1, oracle.jdbc.OracleTypes.INTEGER);
cstmt.setString(2, v_JobTable);
cstmt.setString(3, v_Action);
cstmt.setString(4, v_FacilId);
cstmt.setString(5, v_LinkKeyOld);
cstmt.setString(6, v_LinkKeyNew);
cstmt.registerOutParameter(7, oracle.jdbc.OracleTypes.VARCHAR);
cstmt.execute();
result = cstmt.getInt(1);
v_Result.append(cstmt.getString(7));
}
catch(Exception ee)
{
System.out.println(“Exception:” + e);
}
finally
{
cstmt.close();
return result;
}
}