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);        
}

1 comments:

Rifath said...

Splendid blog I visit this blog it's unimaginably great. Inquisitively, in this blog substance shaped without a doubt and reasonable. The substance of data is useful.
Oracle Fusion HCM Online Training
Oracle Fusion Financials Online Training

Post a Comment

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

Name

Email *

Message *