jahanruhi3@gmai 0 Newbie Poster
package com.batch;

import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import DBConnection.DBConnect;

public class Batch {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public ArrayList BatchAction(String ik) {
        Connection conn = null;
        Statement st1 = null;
        Statement st2 = null;
        ResultSet rs1 = null;
        ResultSet rs2 = null;
        ArrayList al = new ArrayList();
        conn = DBConnect.getConnection();
        final SimpleDateFormat monthDayYearformatter = new SimpleDateFormat(
                "dd MM yyyy HH:mm:ss");

        System.out.print("is it really working....");
        try {
            st1 = conn.createStatement();
            st2 = conn.createStatement();

            //String name = null;
            //rs1 = st1.executeQuery("select * from project_stage where NAME ='"+ name +"' ");

            rs1 = st1.executeQuery("select * from project_stage where NAME =? ");
            //rs1 = st1.executeQuery("select * from project_stage");
             //st1.setString(1,"name");
            ArrayList aL1 = new ArrayList();
            while (rs1.next()) {
                aL1.add(rs1.getString("name"));
            }
            al.add(aL1);
            rs2 = st2.executeQuery("select * from batch order by start_date DESC");
            System.out.println("select * from batch order by start_date DESC");

            // System.out.println("SELECT * FROM BATCH where SCHEDULE_IK=" + ik
            // +"order by IK");

            while (rs2.next()) {
                ArrayList<String> aL = new ArrayList<String>();
                aL.add(Integer.toString(rs2.getInt("IK")));
                aL.add(Integer.toString(rs2.getInt("SCHEDULE_IK")));
                java.util.Date d1 = rs2.getTimestamp("START_DATE");
                java.util.Date d = rs2.getTimestamp("END_DATE");
                if (d != null) {
                    String date = monthDayYearformatter.format(d);
                    aL.add(date);
                } else {
                    aL.add("No Start Date Found ");
                }
                if (d1 != null) {
                    String date1 = monthDayYearformatter.format(d1);
                    aL.add(date1);
                } else {
                    aL.add("No End Date Found");
                }
                String stageType = rs2.getString("STAGE_TYPE");
                if (stageType != null)

                {
                    aL.add(stageType);
                } else {

                    aL.add("No Stage Type Data Found ");
                }
                aL.add(Integer.toString(rs2.getInt("TASK_IK")));
                al.add(aL);
            }

            conn.setAutoCommit(true);

        } catch (SQLException e) {
            e.printStackTrace();
        }
        return al;

    }
}


Error
13:21:31,687 ERROR [STDERR] java.sql.SQLException: ORA-01008: not all variables bound
13:21:31,687 ERROR [STDERR]     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
13:21:31,687 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
13:21:31,687 ERROR [STDERR]     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
13:21:31,687 ERROR [STDERR]     at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
13:21:31,687 ERROR [STDERR]     at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
13:21:31,687 ERROR [STDERR]     at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:790)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.