1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
/**
* @param args
*/
public static void main(String[] args) {
OracleDataSource ods;
try {
// Connexion à la base
ods = new OracleDataSource();
String url = "***";
ods.setURL(url);
ods.setUser("***");
ods.setPassword("**");
Connection conn = ods.getConnection();
System.out.println("Connexion OK");
// Définition des deux listes de produits à rechercher
String[] pl1 = {"000000", "000001"};
//String[] pl1 = {"039710", "046636"};
// Appel de la procédure stockée
OracleCallableStatement cs = (OracleCallableStatement) conn.prepareCall ("begin ? := pck_common_register.find_similar_mffund_list(?); end;");
cs.registerOutParameter(1, OracleTypes.NUMBER);
cs.setPlsqlIndexTable(
2, // Identifiant de l'argument
pl1, // Tableau des valeurs
pl1.length, // Longueur max
pl1.length, // Longueur réelle
OracleTypes.VARCHAR, // Typage
6 // Longueur maxi d'un argument dans le tableau
);
cs.execute();
if(cs.getInt(1) == 0) {
System.out.println("Aucune liste identique trouvée");
} else {
System.out.println("Liste trouvée : "+cs.getInt(1));
}
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
Partager