'Search data for JTable using PLSQL stored procedure

I have a JFrame in which I have populated some data by stored procedure. Now I want to search the data through a JTextField. I used a RowSorter filter method but it didn't filter row in a proper index.

In simple queries, I have used this method to search the data:

Statement st = conn.createStatement();
String query = "SELECT t.mach_name , T.Mach_Id FROM KNT_COMMERCIAL_MACH T " + 
    "WHERE T.Mach_Id LIKE '%" + jTextField7.getText() + "%' " + 
    "or t.mach_name like '%" + jTextField7.getText() + "%'";
ResultSet rs = st.executeQuery(query);
jTableMachine1.setModel(DbUtils.resultSetToTableModel(rs)); 

Can we search data in procedures by the above method? If yes then kindly inform me. Or are there other possibilities to perform searching?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source