Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C14202E3399 for ; Thu, 29 Nov 2007 02:37:26 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 34605-01 for ; Thu, 29 Nov 2007 02:37:21 -0400 (AST) Received: from mail.t-email.hu (mail.t-email.hu [212.51.125.49]) by postgresql.org (Postfix) with ESMTP id 9B8442E3382 for ; Thu, 29 Nov 2007 02:37:23 -0400 (AST) Received: from [10.255.27.145] (line-122-2.gprs.westel900.net [212.51.122.2]) by smtpgw3.mail.westel900.net (Sun Java System Messaging Server 6.1 HotFix 0.11 (built Jan 28 2005)) with ESMTP id <0JS900J1L923ME40@smtpgw3.mail.westel900.net> for pgsql-jdbc@postgresql.org; Thu, 29 Nov 2007 07:37:21 +0100 (MET) Date: Thu, 29 Nov 2007 07:37:12 +0100 From: yoursoft Subject: PreparedStatement vs. Statement problem In-reply-to: To: pgsql-jdbc@postgresql.org Message-id: <474E5E18.4080909@freemail.hu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.984 tagged_above=0 required=5 tests=AWL=-1.596, BAYES_50=0.001, RCVD_IN_BL_SPAMCOP_NET=1.96, RCVD_IN_SORBS_WEB=0.619 X-Spam-Level: X-Archive-Number: 200711/86 X-Sequence-Number: 17841 I have a problem: SELECT * FROM mytable WHERE c1 like 'a' UNION ALL SELECT * FROM mytable WHERE c2 like 'a' || '%' AND c2 not like 'a' UNION ALL SELECT * FROM mytable WHERE c2 like '%' || 'a' || '%' AND c2 not like 'a' || '%' AND c2 not like 'a' LIMIT 101 OFFSET 0 Where 'a' is a variable. When I run this query from Statement. There is no problem. The result is ordered by: First SELECT, second SELECT third SELECT. When I run this query from PreparedStatement ('a' values replaced by ?). The result is ordered by in alphabets.Why? Regards, Ferenc