/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;


import LoginDb.DbHandler;
import java.sql.CallableStatement;
import java.sql.Connection;
import oracle.jdbc.OracleTypes;

/**
 *
 * @author 1242938
 */
public class AmendInterestDao {

    public String AmendInterestProc(String pacsId, String accNo, String newCurrInt, String newPenalInt, String newNpaInt, String tellerId) {
        Connection con = null;
        CallableStatement proc = null;
        String res = null;


        try {
            con = DbHandler.getDBConnection();
            proc = con.prepareCall("{ call operations2.LOAN_OUSTINT_UPDATE(?,?,?,?,?,?,?) }");

            proc.setString(1, pacsId);
            proc.setString(2, accNo);
            proc.setString(3, newCurrInt);
            proc.setString(4, newPenalInt);
            proc.setString(5, newNpaInt);
            proc.setString(6, tellerId);
            proc.registerOutParameter(7, OracleTypes.VARCHAR);


            proc.executeUpdate();

          //  res = proc.getString(7);//error message from dds procedure

        } catch (Exception e) {
           // e.printStackTrace();
           // System.out.println("Exception occured  in AmendInterestProc for user Id :" + tellerId);
           // res= "Error occured. Please try again";
           System.out.println("Error occurred during processing.");
        } finally {
            try {
                if (con != null) {
                    con.close();
                }
            } catch (Exception e) {
               // e.printStackTrace();
               System.out.println("Error occurred during connection close.");
            }
        }

        return res;
    }

    
}
