Pages

Recently Viewed

Saturday, August 27, 2011

Execute sql script in OAF

// Required import packages
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;   
import oracle.jbo.domain.Number;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
//


try
   {
    Connection conn = paramOAPageContext.getApplicationModule(paramOAWebBean).getOADBTransaction().getJdbcConnection();

    String Query ="SELECT empId resultId,empName resultName,empPosition resultPos from XXXXX_TABLE WHERE DeptId=:1";
                                   
    PreparedStatement stmt = conn.prepareStatement(Query);               

    stmt.setInt(1, departmentId);                                       

                                   
    for (ResultSet resultset = stmt.executeQuery(); resultset.next(); )
    {   
        int employeeId = resultset.getInt("resultId");
        String employeeName  = resultset.getstring("resultName");
        String employeePosition = resultset.getString("resultPos");
    }

    stmt.close();
                                              
   }catch(SQLException sqle)
   {
       throw new OAException("Exception Block"+sqle);
   }

2 comments:

  1. Form was already there in D2k now we are converting that form to Custom OAF


    In D2K from they used GLOBAL TEMPORARY TABLE For insert and updating in Standard Table
    In Procedures they used below for D2K form
    go_block
    set_block_property
    CLEAR_BLOCK


    for form can i use this Procedures In OAF or else we must create another Procedures for OAF

    * when they are updating they write some validations in that

    Thanks
    vamsi

    ReplyDelete
  2. Hello Vamsi, these are form specific procedure and will be called inside the D2K forms only. For any custom validation in
    OAF - we have to create new procedure and call as explained above
    Forms - Use form personalization to call custom procedure

    ReplyDelete