Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:[Help] PreparedStatement and BigDecimal [Re:snowbug]
Julian13





发贴: 387
积分: 52
于 2002-12-16 20:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
snowbug wrote:
I don't have much experience with PostgreSql, but here is what the problem is:
The "? is null" can not be used in the prepared statement, you will need to create seperate queries:

Another thing is, from my experience (with Oracle), the setNull() does not work as the way it suppose to be, and there is no workaround. So usually I avoid use setNull().

Please give it a try and let us know if it fixes the problem.


thx for your suggestion.

setNull() do on PostgreSQL. the error may happen over the incompatible of the BigDecimal. i found the following SQL for my prepared statement:


SELECT object_id, amount FROM test WHERE (object_id LIKE ? OR ? IS NULL) AND (amount = ?::numeric(5,2) OR ?::numeric(5,2) IS NULL)


It try to enforce the explicit casting. Though it look strange, it work. Tongue




话题树型展开
人气 标题 作者 字数 发贴时间
7129 [Help] PreparedStatement and BigDecimal Julian13 961 2002-12-13 18:13
5192 Re:[Help] PreparedStatement and BigDecimal snowbug 1746 2002-12-13 22:48
5762 Re:[Help] PreparedStatement and BigDecimal Julian13 861 2002-12-16 20:13

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923