Oracle中如何比较列和参数?
我的代码是这样的..
SELECT ALL TBL_MONITOR.ITEM_ID, TBL_MONITOR.CATEGORY,
TBL_MONITOR.BRANDNAME, TBL_MONITOR.PRICE, TBL_MONITOR.QUANTITY
FROM TBL_MONITOR
where
case when :pricetag = 'Great' then tbl_monitor.price >= :para_price end,
case when :pricetag = 'Less' then tbl_monitor.price >= :para_price end
这部分不起作用,它说..缺少关键字==> >= :para_price end
==> >= :para_price end,
我想要做的是,如果用户输入“更大”,报告将显示大于“:para_price”的价格 我该如何解决这个问题?预先非常感谢:)
my code goes like this..
SELECT ALL TBL_MONITOR.ITEM_ID, TBL_MONITOR.CATEGORY,
TBL_MONITOR.BRANDNAME, TBL_MONITOR.PRICE, TBL_MONITOR.QUANTITY
FROM TBL_MONITOR
where
case when :pricetag = 'Great' then tbl_monitor.price >= :para_price end,
case when :pricetag = 'Less' then tbl_monitor.price >= :para_price end
this part does not work, it says.. missing keyword ==> >= :para_price end
==> >= :para_price end,
wat i want to do is if the user input 'Greater' the reports will show prices greater than the ':para_price'
how would i fix this? Thanks a lot in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
试试这个
Try out this
SQL
CASE
语句(除了您所犯的语法错误之外)不是像 C 或 PHP 中那样的流程控制指令。它是一个返回值的表达式,而不是决定将执行代码的哪一部分的方法。您并不想说出您想要完成什么或它是如何失败的,但看起来您想要一个简单的表达式:
The SQL
CASE
statement (apart from the syntax errors you are making) is not a flow control instruction like in C or PHP. It's an expression that returns a value and not a way to decide which part of your code will be executed.You didn't care to say what you are trying to accomplish or how is it failing, but it looks like you want a simple expression:
尝试这样:
Try like this: