Java Basic Problems

Java Vector Numeric value and SQL Query: How to use Numeic or integer values of a vector in SQL and also how to execute them.


use Vector numeric or integer  value in sql using javaSometimes we may need to use the value of a vector mainly the integer or numeric value in SQL to execute a query . Suppose you have a vector named   studentAge which contains two numeric value for example: [10,12]. Now, if you want to use these two vectors in the SQL to for query execution then you have to write the query as given below.

String sql=”select student_name from student where student_age in (” + studentAge .toString().substring(1, studentAge.toString().lastIndexOf(“]”))+”) and student_class =”+student-class;

Just You have to use the following line

(” + studentAge.toString().substring(1, studentAge.toString().lastIndexOf(“]”))+”)

 

Continue reading “Java Vector Numeric value and SQL Query: How to use Numeic or integer values of a vector in SQL and also how to execute them.”