Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?
Дата
Msg-id CAKFQuwaLmrFiSAOjzcK2-43F-016CZhP5iRpnyzJ0PzsKEgzog@mail.gmail.com
обсуждение исходный текст
Ответ на Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?  (Karen Goh <karenworld@yahoo.com>)
Список pgsql-sql
On Saturday, July 13, 2019, Karen Goh <karenworld@yahoo.com> wrote:
            String sql1 = "select tutor_id, subject_name from tutor_subject where subject_name in ("
                    + builder.deleteCharAt(builder.length() - 1).toString() + ")";

            PreparedStatement ps2 = connection.prepareStatement(sql1);

            ps2.setInt(1, tutor_id);           

            ps2.setString(2, item);   


I still don’t see any question marks and you don’t show what is in the builder but assuming the builder has two question marks they both go into the IN expression but then you are comparing subject_name to an integer tutor_id at param 1 which would provoke that error.

David J.

В списке pgsql-sql по дате отправления:

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?
Следующее
От: Karen Goh
Дата:
Сообщение: Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?