Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

multiple case statement for one column

manojthakuriiMar 28 2022

Hello Sir,

Can we write a multiple case statements for a column in sql
I have only one column as a reactorance column in a table
The DB version is oracle 19.0.0.0.0
I wanted to do a calculation for a field.
I have a meter table where we have a measurement record as well as a previous measurement record for a meter.
The logic i wanted to write is

case when measurement_1 is not null and measurement_2 is not null
(measurement - previous_measurement/previous_measurement) * 100 and if this percentage deviation is < 5 then make it 'Normal'
when there is no previous measurement then take the attribute value and the calculation would be
(measurement - attribute_value)/attribute_value) * 100 and if this percentage deviation is <=5 then make it normal.

How can this be achieved this.
Appreciate your help sir

Comments
Post Details
Added on Mar 28 2022
9 comments
1,589 views