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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Karen Goh <karenworld(at)yahoo(dot)com>
Cc: "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?
Date: 2019-07-14 16:40:01
Message-ID: CAKFQuwaLmrFiSAOjzcK2-43F-016CZhP5iRpnyzJ0PzsKEgzog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Saturday, July 13, 2019, Karen Goh <karenworld(at)yahoo(dot)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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Karen Goh 2019-07-16 06:14:35 Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?
Previous Message Andrew Gierth 2019-07-14 08:10:01 Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?