Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hmVMz-0000zl-Uh for pgsql-sql@arkaria.postgresql.org; Sun, 14 Jul 2019 03:40:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hmVMy-00060c-0O for pgsql-sql@arkaria.postgresql.org; Sun, 14 Jul 2019 03:40:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hmVMx-00060V-7y for pgsql-sql@lists.postgresql.org; Sun, 14 Jul 2019 03:40:11 +0000 Received: from sonic311-15.consmr.mail.bf2.yahoo.com ([74.6.131.125]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hmVMp-00024L-UZ for pgsql-sql@lists.postgresql.org; Sun, 14 Jul 2019 03:40:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1563075601; bh=HX+JZP2L4Uv/ZM1wZdEQag+R+xPzkCHdqjPM/EIMZRU=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject; b=WMRxN7fyFG81FdpIcrpdHuQe5pSAS34kiysYPaKmEvrFQOYxdDmOwuwYc/Ij8dXgIvAgoGcu/rHLciJ+uEWz0eNwwNGwfOpXxVs7pQaFfGtIDgC0sGpD+KOGVlIB4oY/byy+nEspDI8yauT5GCQXiJ0/wYXZggThntaAfVSmTs1mDsPdfjb/yWcCELWdSHbM3lB0B0b5P+dMvIkMipElHjLxEGyUDeTRRvSTsQrxdXrj/iY/DXdmD2k2KVOm4lU7Fg3M6B5ERnZci6UUU3oB5VFJzyJ3Kw7C4AdINGRKWQi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wigOTEjuvAIzeW UyhbpHViAyH1wIU2s6nz7ma8gNLo5EY.2lOJ_n27ZX0x_uMkcwEQiEwTadETlEj2yFg2jwhaMqot 1xDO9li2pOfyOkYHjBBXqh1Za6kMvkBAwdtPk61ms4BKsso2p4wAFVEJdd5OgKU6B8NPYfgDQSmd WGE0Qdyvh5AIQehSL3LbkGdURRzVbbMyQhYsDGfvxSeP_GHwpcy7sgWteMDGZ0IvcfHY- Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Sun, 14 Jul 2019 03:40:01 +0000 Date: Sun, 14 Jul 2019 03:39:58 +0000 (UTC) From: Karen Goh To: pgsql-sql@lists.postgresql.org Message-ID: <1846547624.530883.1563075598322@mail.yahoo.com> In-Reply-To: <110414461.528890.1563075361778@mail.yahoo.com> References: <110414461.528890.1563075361778@mail.yahoo.com> Subject: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_530882_952736307.1563075598320" Content-Length: 11001 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_530882_952736307.1563075598320 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =20 re-send. Kindly assist. Thanks. ----- Forwarded Message ----- From: Karen Goh To:= "pgsql-sql@lists.postgresql.or" Sent: Sunda= y, July 14, 2019, 11:36:01 AM GMT+8Subject: how to resolve org.postgresql.u= til.PSQLException: ERROR: operator does not exist: text =3D integer? Hi, This is a continuation of my last problem - not sure if I should write from= there cos the first part was solved with the help from this group. I was trying to get the matching tutor_id with the parameter values which i= s in this case subject_names from a table which contains both the tutor_id = and the subject_names. Here's the error message: org.postgresql.util.PSQLException: ERROR: operator does not exist: text =3D= integer =C2=A0 Hint: No operator matches the given name and argument type(s). You m= ight need to add explicit type casts. =C2=A0 Position: 69 =C2=A0=C2=A0=C2=A0 at org.postgresql.core.v3.QueryExecutorImpl.receiveError= Response(QueryExecutorImpl.java:2433) =C2=A0=C2=A0=C2=A0 at org.postgresql.core.v3.QueryExecutorImpl.processResul= ts(QueryExecutorImpl.java:2178) =C2=A0=C2=A0=C2=A0 at org.postgresql.core.v3.QueryExecutorImpl.execute(Quer= yExecutorImpl.java:306) =C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc.PgStatement.executeInternal(PgSta= tement.java:441) =C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc.PgStatement.execute(PgStatement.j= ava:365) =C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc.PgPreparedStatement.executeWithFl= ags(PgPreparedStatement.java:155) =C2=A0=C2=A0=C2=A0 at org.postgresql.jdbc.PgPreparedStatement.executeQuery(= PgPreparedStatement.java:118) =C2=A0=C2=A0=C2=A0 at Controller.searchController.doPost(searchController.j= ava:108) Here's the code snippet which I do not know where I had gone wrong: =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 String sql1 =3D "s= elect tutor_id, subject_name from tutor_subject where subject_name in (" =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 + builder.deleteCharAt(builder.length() - 1).toString()= + ")"; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 PreparedStatement = ps2 =3D connection.prepareStatement(sql1); HashMap> tutorSubject =3D new HashMap>();=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0=20 for(String item : subjs) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 int tutor_id =3D t= utor.getTutor_id(); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 =C2=A0 ps2.setInt(1, tutor_id)= ;=C2=A0 =C2=A0 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=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tutorSubject.put(tutor_id, subjs);= =C2=A0=C2=A0=C2=A0=20 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 System.out.println(tutorSubject); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 } =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=20 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 System.out.println= ("tutor ID=3D" + rs.getInt("tutor_id") + ", subjectName=3D" + rs.getString(= "subject_name")); Hope someone could point out my mistake. Thanks. =20 ------=_Part_530882_952736307.1563075598320 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

re-send. Kindly assist. Thanks.

=
=
----- Forwarded Messa= ge -----
From: Karen Goh <karenworld@ya= hoo.com>
To: "pgsql-sql@lists.postgresql.or" <pgsql-= sql@lists.postgresql.or>
Sent: Sunday, July 14, 2019, 1= 1:36:01 AM GMT+8
Subject: how to resolve org.postgresql.ut= il.PSQLException: ERROR: operator does not exist: text =3D integer?

Hi,

This is a continuation of my last problem = - not sure if I should write from there cos the first part was solved with = the help from this group.

I was trying to get the matching tutor_id with the parameter values whi= ch is in this case subject_names from a table which contains both the tutor= _id and the subject_names.

Here's the error message:

org.postgresql.util.PSQLException: ERROR: operator does not exist:= text =3D integer
  Hint: No operator matche= s the given name and argument type(s). You might need to add explicit type = casts.
  Position: 69
    at org.postgresql.core.v3.QueryExecutorImpl.receiveE= rrorResponse(QueryExecutorImpl.java:2433)
 &= nbsp;  at org.postgresql.core.v3.QueryExecutorImpl.processResults(Quer= yExecutorImpl.java:2178)
    at or= g.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)<= br>
    at org.postgresql.jdbc.PgState= ment.executeInternal(PgStatement.java:441)
 =    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:36= 5)
    at org.postgresql.jdbc.PgPr= eparedStatement.executeWithFlags(PgPreparedStatement.java:155)
    at org.postgresql.jdbc.PgPreparedStatement= .executeQuery(PgPreparedStatement.java:118)
 = ;   at Controller.searchController.doPost(searchController.java:1= 08)

Here's the code sn= ippet which I do not know where I had gone wrong:


    &= nbsp;       String sql1 =3D "select tutor_id, subj= ect_name from tutor_subject where subject_name in ("
              &n= bsp;     + builder.deleteCharAt(builder.length() - 1).toStri= ng() + ")";

 &nbs= p;          PreparedStatement ps2 =3D co= nnection.prepareStatement(sql1);
HashMap<Integ= er, ArrayList<String>> tutorSubject =3D new HashMap<Integer, Ar= rayList<String>>();         &nb= sp; 
for(String item : subjs) {
            int= tutor_id =3D tutor.getTutor_id();
  &n= bsp;         ps2.setInt(1, tutor_id);   = ;        
    &nbs= p;       if (item !=3D null) {
&n= bsp;               subjs.add(item)= ;
            ps2.= setString(2, item);   
  &n= bsp;         }           = ;              
            = ps2.executeQuery();
     &nbs= p;  while (rs.next()) {
    &= nbsp;               = tutor_id =3D rs.getInt("tutor_id"); 
 =                 = ;   subjs.add(rs.getString("subject_name"));
              = ;               &nbs= p;             
           =             tutorSubject.put= (tutor_id, subjs);   
  = ;               &nb= sp;      System.out.println(tutorSubject);
            &nbs= p;           }
           
            Sys= tem.out.println("tutor ID=3D" + rs.getInt("tutor_id") + ", subjectName=3D" = + rs.getString("subject_name"));


Hope someone could point out my mista= ke.

Thanks.
<= div dir=3D"ltr">
------=_Part_530882_952736307.1563075598320--