Search code examples
sqloracle-databaseoraclereports

How to compare a column to a parameter in Oracle?


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 :)


Solution

  • Try out this

    WHERE 
    (:pricetag = 'Great' AND tbl_monitor.price >= :para_price)
    OR
    (:pricetag = 'Less' AND tbl_monitor.price <= :para_price)