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 1hnGu1-0005G6-Lw for pgsql-sql@arkaria.postgresql.org; Tue, 16 Jul 2019 06:25:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hnGu0-0006aE-Ay for pgsql-sql@arkaria.postgresql.org; Tue, 16 Jul 2019 06:25:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnGtz-0006Zv-Nz for pgsql-sql@lists.postgresql.org; Tue, 16 Jul 2019 06:25:28 +0000 Received: from mail.inqbus.de ([164.177.165.236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hnGtw-0003ck-2K for pgsql-sql@lists.postgresql.org; Tue, 16 Jul 2019 06:25:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stb-datenservice.de; s=20160215; h=Content-Type:In-Reply-To:MIME-Version: Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fhqq8N7ELfny3YSx8zJ08h+DgLatpY0OLyhXqlAzZDo=; b=KgqbXXkXP6iVVJuvJeWpc/YpL D57L2hUagpaYlXc6SUN2ahC5ayOwVm/tp1joIyfSgkllFjGvJk3R0emEkZsYgcef7HVymmICMpaXJ RAUqEn4w0lEeTRIsNu1StjTxMfL4CDjgc5l5tnmeqSwTRhR+G66B0EXcG4Hb7DD/jdL/s=; Received: from p578c3f48.dip0.t-ipconnect.de ([87.140.63.72]:57440 helo=[192.168.178.130]) by mail.inqbus.de with esmtpa (Exim 4.89) (envelope-from ) id 1hnGtr-0000hf-Tp for pgsql-sql@lists.postgresql.org; Tue, 16 Jul 2019 08:25:21 +0200 Subject: Re: Fw: how to resolve org.postgresql.util.PSQLException: ERROR: operator does not exist: text = integer? To: pgsql-sql@lists.postgresql.org References: <110414461.528890.1563075361778@mail.yahoo.com> <1846547624.530883.1563075598322@mail.yahoo.com> <40544440.741577.1563178850210@mail.yahoo.com> <768811852.1032981.1563242356010@mail.yahoo.com> <774271584.1091322.1563257675315@mail.yahoo.com> <1984680550.1098414.1563257845450@mail.yahoo.com> From: =?UTF-8?Q?Martin_St=c3=b6cker?= Message-ID: Date: Tue, 16 Jul 2019 08:25:17 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1984680550.1098414.1563257845450@mail.yahoo.com> Content-Type: multipart/alternative; boundary="------------BDDDC64953609F1BC41DB310" Content-Language: de List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------BDDDC64953609F1BC41DB310 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 >     at > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433) >     at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178) >     at > org.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) >     at > org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155) >     at > org.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> tutorSubject = new > HashMap>(); > 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 > 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 > wrote: > > On Mon, Jul 15, 2019 at 6:59 PM Karen Goh > > 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 --------------BDDDC64953609F1BC41DB310 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit 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
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)
    at org.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)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)
    at org.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
--------------BDDDC64953609F1BC41DB310--