Aug 20, 2019

Call PL/SQL Function | From OAF Page



 import oracle.apps.fnd.framework.server.OADBTransaction; 
 import oracle.jdbc.driver.OracleTypes; 
 import oracle.jdbc.OracleCallableStatement;
 
 public String callFunction( String id) 
 { 
      String status = null;
      OADBTransaction oadbtransaction = getOADBTransaction(); 
      OracleCallableStatement oraclecallablestatement = null; 
      Object obj = null; 
     
      String sqlString = "BEGIN :1:=xx_pkg.xx_func( p_id => :2 ); END;"; 
      
      try 
      { 
           oraclecallablestatement =             (oracleCallableStatement)oadbtransaction.createCallableStatement(sqlString , 1); 
           oraclecallablestatement.registerOutParameter(1, OracleTypes.VARCHAR, 0, 10); 
           oraclecallablestatement.setString(2, id); 
           oraclecallablestatement.executeQuery(); 
           status = String.valueOf(oraclecallablestatement.getString(1)); 
      } 
      catch(Exception exception1) 
      { 
           throw OAException.wrapperException(exception1); 
      } 
      finally 
      { 
           try 
           { 
                oraclecallablestatement.close(); 
           } 
           catch(Exception exception2) 
           { 
                throw OAException.wrapperException(exception2); 
           } 
      } 
      return status ; 
 }  

:1 è Out Parameter to hold results from function.

:2 è IN Parameter   
 




No comments:

Post a Comment

Useful Workflow Commands

  WFLOAD apps/columbus789 0 Y DOWNLOAD APEXP_FINDEV.wft APEXP Locations: $PO_TOP/patch/115/import/US/porpocha.wft $PO_TOP/patch/115/import/U...