Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

PreparedStatement vs. Statement problem



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




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group