PreparedStatement vs. Statement problem

From: yoursoft <yoursoft(at)freemail(dot)hu>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: PreparedStatement vs. Statement problem
Date: 2007-11-29 06:37:12
Message-ID: 474E5E18.4080909@freemail.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2007-11-29 09:21:35 Re: PreparedStatement vs. Statement problem
Previous Message Michael Andreasen 2007-11-28 14:50:53 ssl connection and webstart