0

I have two Different Database (SqlServer,Oracle)

SqlServer having CUSTOMER_ID information and Oracle has CUSTOMER_ID and other column information

I want to achive below scenorio (Get record set from 1st method and apply that valus as condition in (WHERE IN ) 2nd method )

public void getvariable_values() throws SQLException, ClassNotFoundException
{
    System.out.println("Oracle Start Connecting Server");
    oracon = DriverManager.getConnection(oe_url, oe_user, oe_password);
    System.out.println("Oracle Connection succeed");
    Statement s1 = (Statement) oracon.createStatement();
    sql_rs_var = s1.executeQuery("SELECT CUSTOMER_ID FROM CUSTOMER_SERVER )");
    getDatafromsql(sql_rs_var);
}



public void getDatafromsql(Resultset inp_record) throws SQLException, ClassNotFoundException 
{

    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    System.out.println("SQL Server Start Connecting ");
    Connection sqlcon = DriverManager
            .getConnection(s_url, s_username, s_password);
    System.out.println("Sql server Connection valid");
    PreparedStatement s1 = sqlcon.prepareStatement("SELECT TOP 6 * FROM documents where customer_id = ?");
    //Something want to apply like below for where in condition
    s1.setString( 1,inp_record);
    sql_rs = s1.executeQuery();
    setdataOracle(sql_rs);
    sqlcon.close();
}

Please suggest how to apply full record set in WHERE IN condition for method (getDatafromsql) in SQL

Elavarasan
  • 301
  • 1
  • 5
  • 14

0 Answers0