Basic question, beginning user.
I have a column (price) in a table (room). The column (price) has a constraint that it has to be between 20 and 100.
I need to update the column (price) to reflect a price increase of 5%. However, some of the fields in this column will have a price >100 after the update, causing it to fall
outside of the constraint. To address this, those prices that exceed 100 need to be set to 100 instead. Here is what I have:
UPDATE ROOM
SET PRICE=
CASE
WHEN PRICE*1.05<100
THEN PRICE*1.05
ELSE PRICE=100
END CASE
WHERE HOTELNO='1004' OR
HOTELNO='1001' OR
HOTELNO='1002'
;
Best I could come up with in my searches. I am getting the following error:
ORA-00905: missing keyword
This is using Oracle 10g.
Thanks in advance for any help.
try following