agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Karen Goh <karenworld@yahoo.com>
To: Martin Stöcker <martin.stoecker@stb-datenservice.de>
To: pgsql-sql@lists.postgresql.org
Subject: Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?
Date: Tue, 16 Jul 2019 08:21:20 +0000 (UTC)
Message-ID: <59735533.1068095.1563265280844@mail.yahoo.com> (raw)
In-Reply-To: <f11f7f05-e3fc-2794-e4ec-4b7144ae56be@stb-datenservice.de>
References: <110414461.528890.1563075361778@mail.yahoo.com>
	<1846547624.530883.1563075598322@mail.yahoo.com>
	<CAKFQuwaLmrFiSAOjzcK2-43F-016CZhP5iRpnyzJ0PzsKEgzog@mail.gmail.com>
	<40544440.741577.1563178850210@mail.yahoo.com>
	<CAKFQuwYJsFw9p_qLyashvUmONFZre9OxgEWxDkqdY6-gWB9G7A@mail.gmail.com>
	<768811852.1032981.1563242356010@mail.yahoo.com>
	<CAKFQuwaC_Z24XxjvsSgYPvSNpu+K1Z9_60auVxEpjFQpE5zrFg@mail.gmail.com>
	<774271584.1091322.1563257675315@mail.yahoo.com>
	<1984680550.1098414.1563257845450@mail.yahoo.com>
	<f11f7f05-e3fc-2794-e4ec-4b7144ae56be@stb-datenservice.de>

Can I know which forum to post to cos I think this may be the wrong forum. Cos it is sql so this forum maybe for sql execute inside the database. However, I read there is no more jdbc forum, correct me if I am wrong.


Sent from Yahoo Mail for iPhone


On Tuesday, July 16, 2019, 2:25 PM, Martin Stöcker <martin.stoecker@stb-datenservice.de> wrote:

 Hi,
 
 please post your statement but not all this java stuff.
 Nobody knows the type and content of your builder varaible.
 
 Regards Martin
 
 
 
 
 Am 16.07.2019 um 08:17 schrieb Karen Goh:
  
 
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 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 = integer
    Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
    Position: 69
      atorg.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)
      atorg.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)
      atorg.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)
      at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
      at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
      atorg.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)
      atorg.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:118)
      at Controller.searchController.doPost(searchController.java:108)
  
  Here's the code snippet which I do not know where I had gone wrong:
  
  
              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);
  HashMap<Integer, ArrayList<String>> tutorSubject = new HashMap<Integer, ArrayList<String>>();            
  for(String item : subjs) {
              int tutor_id = tutor.getTutor_id();
              ps2.setInt(1, tutor_id);            
              if (item != null) {
                  subjs.add(item);
              ps2.setString(2, item);     
              }                          
              ps2.executeQuery();
          while (rs.next()) {
                      tutor_id = rs.getInt("tutor_id");  
                      subjs.add(rs.getString("subject_name"));
                                              
                          tutorSubject.put(tutor_id, subjs);    
                          System.out.println(tutorSubject);
                          }
              
              System.out.println("tutor ID=" + rs.getInt("tutor_id") + ", subjectName=" + rs.getString("subject_name"));
  
  
  Hope someone could point out my mistake.
  
  Thanks. 
 
 Sent from Yahoo Mail for iPhone
 
 
Begin forwarded message:
 
 On Tuesday, July 16, 2019, 2:14 PM, Karen Goh <karenworld@yahoo.com> wrote:
 
   Attn to all: 
  For sone kind of strange reason I do not know why the mail is not sent to all. 
  I have normally wrote n replied to the last person who wrote but yahoo mail didn’t let me write at there. 
  Hope everyone receives this mail this time round. 
  N please help me. 
  Tks! 
  
  
 
 Sent from Yahoo Mail for iPhone
 
 
Begin forwarded message:
 
 On Tuesday, July 16, 2019, 1:01 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
  
     On Mon, Jul 15, 2019 at 6:59 PM Karen Goh <karenworld@yahoo.com> wrote:
    
 
 May I know why did you say I am comparing subject_name to an integer ?
 
 I am trying to get both tutor_id and subject_name from the same table based on the no of ? in subjectName as per parameterValues.
  
 
  Again, you need to send messages to the mailing, not me personally. 
  That said you might want to first figure out what: 
  ps2.setInt(1, tutor_id); 
  
  is supposed to accomplish in your code.  
  David J. 
       
     
 
 -- 

Widdersdorfer Str. 415, 50933 Köln; Tel. +49 / 221 / 9544 010
HRB Köln HRB 75439, Geschäftsführer: Dr. Dirk Goldner 

view thread (24+ messages)  latest in thread

Message-ID: <59735533.1068095.1563265280844@mail.yahoo.com>
Permalink:  ../59735533.1068095.1563265280844@mail.yahoo.com/
Also on:    postgresql.org/message-id/59735533.1068095.1563265280844@mail.yahoo.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: karenworld@yahoo.com, martin.stoecker@stb-datenservice.de, pgsql-sql@lists.postgresql.org
  Subject: Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer?
  In-Reply-To: <59735533.1068095.1563265280844@mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox