Showing posts with label How to call procedure from oaf page. Show all posts
Showing posts with label How to call procedure from oaf page. Show all posts

Friday, 29 June 2018

How to call procedure from oaf page

How to call procedure from oaf page

In this post, I will share the code to call procedure from the OAF page. To call procedure from OAF , we need to create the controller of the page and then write the code in the controller to call procedure. With this code , we can directly execute the Data base procedure from the OAF controller directly. To execute Procedure from OAF page , we need to use OADBTransaction object of the OAF , which helps to execute the sql and procedure in Data base from OAF controller. Second important things we needs to execute procedure is OracleCallableStatement.You can call PL/SQL block from the OA Framework using callable statement.
 

Here below is the example to call procedure from OAF Page

 
 
OAApplicationModule am = (OAApplicationModule)paramOAPageContext.getApplicationModule(paramOAWebBean);
 
OADBTransaction txn = am.getOADBTransaction();
 
String str="BEGIN xx_test_pkg.updaterecord(P_Header_id => :1);END;";
 
OracleCallableStatement Callstmt=(OracleCallableStatement)txn.createCallableStatement(str,1);

String Result = "";
Number localNumber;

try {
Callstmt.setString(1,RptHdrId);
Callstmt.execute();      
Callstmt.close();

 }
catch(SQLException sqle)
  {
paramOAPageContext.writeDiagnostics(this, "Exception in calling sqlstatement  "+sqle, 2);        
}

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *