update: the same behavior applies to OFFSET ? Dne pondělí 9. března 2015 10:43:32 UTC+1 Vojtěch Hordějčuk napsal(a): > > Hi, is this a correct behavior? > > If I prepare statement with a limit statement, e.g. *SELECT * FROM > system_range(1,10) LIMIT ?* and then get the parameter meta data, I would > get VARCHAR as a data type of the limit related placeholder. I am expecting > a numeric data type, because *LIMIT 'abc' *is not a valid call (AFAIK). > > This is a test case which fails for H2 1.3.171: > > public class BugDemo { > public static void main(String[] args) throws SQLException { > Connection conn = DriverManager.getConnection("jdbc:h2:mem:test"); > PreparedStatement stmt = conn.prepareStatement("SELECT * FROM > system_range(1,10) LIMIT ?"); > ParameterMetaData pmd = stmt.getParameterMetaData(); > System.out.println("type = " + pmd.getParameterTypeName(1)); // = > VARCHAR (expected numeric) > conn.close(); > } > } > > > > Workaround: > > just replace "LIMIT ?" with "LIMIT (select id FROM items WHERE id=?)" > where id is INTEGER type > > Thank you for any help or better workaround. > Vojta >
-- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.