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

From David G. Johnston
Subject Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?
Date
Msg-id CAKFQuwaLmrFiSAOjzcK2-43F-016CZhP5iRpnyzJ0PzsKEgzog@mail.gmail.com
Whole thread Raw
In response to Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?  (Karen Goh <karenworld@yahoo.com>)
List 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 by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?
Next
From: Karen Goh
Date:
Subject: Fw: how to resolve org.postgresql.util.PSQLException: ERROR:operator does not exist: text = integer?