pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: yoursoft <yoursoft@freemail.hu>
To: pgsql-jdbc@postgresql.org
Subject: PreparedStatement vs. Statement problem
Date: Thu, 29 Nov 2007 07:37:12 +0100
Message-ID: <474E5E18.4080909@freemail.hu> (raw)
In-Reply-To: <c752d6bd0711280650q53b3547ew7ea92ca45fd38d12@mail.gmail.com>
References: <c752d6bd0711280650q53b3547ew7ea92ca45fd38d12@mail.gmail.com>

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




view thread (4+ messages)  latest in thread

Message-ID: <474E5E18.4080909@freemail.hu>
Permalink:  ../474E5E18.4080909@freemail.hu/
Also on:    postgresql.org/message-id/474E5E18.4080909@freemail.hu

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: yoursoft@freemail.hu
  Subject: Re: PreparedStatement vs. Statement problem
  In-Reply-To: <474E5E18.4080909@freemail.hu>
  References: <c752d6bd0711280650q53b3547ew7ea92ca45fd38d12@mail.gmail.com> <474E5E18.4080909@freemail.hu>

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

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