/*
 * 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 CBSAccountMappingDao {

    public String CBSAccountMappingProc(String pacsId, String tellerId, String accNo, String linkAcc, String checkOpt, String newpin, String currAcc) {
        Connection con = null;
        CallableStatement proc = null;
        String res = null;


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

            proc.setString(1, pacsId);
            proc.setString(2, tellerId);
            proc.setString(3, accNo);
            proc.setString(4, linkAcc);
            proc.setString(5, checkOpt);           
            proc.registerOutParameter(6, OracleTypes.VARCHAR);
            proc.setString(7, newpin);
            proc.setString(8, currAcc);

            proc.executeUpdate();

          //  res = proc.getString(6);//error message

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

        return res;
    }

    
}
