Sunday, March 20, 2016

How to call DB Packages through Callable Statements Registering the out Parameters in OAF


Code Written After Process Form Request:-

public void populateProfiles( OAPageContext pageContext
                            , OAWebBean webBean
                            , String v_FinancialYear
                            , String v_demandType
                            , String V_HeaderID
                            , String v_TransCurr
                            , String v_demandIn
                            , String Fundtype
                            , String ReportCurr
                            , String Qtr
                            )
{
   try
   {
        OAApplicationModule am = pageContext.getApplicationModule(webBean);
        OADBTransaction txn = am.getOADBTransaction();
        // OAViewObject vh = (OAViewObject)am.findViewObject("bgtCompProcessVO1");
       
        CallableStatement cs = null;
        cs = txn.createCallableStatement("begin XXAA_PROCESS_PKG.XXAA_COMP_PROCEED (:1,:2,:3,:4,:5,:6,:7,:8,:9); END;", 0);
       
        cs.setString(1, v_FinancialYear);
        System.out.println("v_FinancialYear:"+v_FinancialYear);
       
        cs.setString(2, v_demandType);
        System.out.println("v_demandType:"+v_demandType);                
       
        cs.setString(3, V_HeaderID);
        System.out.println("V_HeaderID:"+V_HeaderID);
       
        cs.setString(4, v_TransCurr);
        System.out.println("v_TransCurr:"+v_TransCurr);
       
        cs.setString(5, v_demandIn);
        System.out.println("v_demandIn:"+v_demandIn);
       
        cs.setString(6,Fundtype);
        System.out.println("Fundtype:"+Fundtype);
       
        cs.setString(8,ReportCurr);
        System.out.println("ReportCurr:"+ReportCurr);
       
        cs.setString(9,Qtr);
        System.out.println("Qtr:"+Qtr);
       
        cs.registerOutParameter(7, Types.VARCHAR);
        cs.execute();
       
         p_docno = cs.getString(7);
   
        System.out.println("Flag populate: " + p_docno);
     
    }
   
    catch (SQLException sqle)
    {
        sqle.printStackTrace();
    } //End Catch
 
 }



No comments:

Post a Comment

Best Blogger TipsGet Flower Effect