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!

Compare multiple columns and update a column based on comparison

2960159May 28 2015 — edited May 28 2015

Hi All,

I have  to update the STATUS column of the below table structure.

Status  should be 'P' if  all the count columns are equal else status should be 'F'

The  column value can be ''NA'. if the value is NA,then avoid that column comparison;compare only other 3  columns.

My output should look like below.

Id cnt1   cnt2 cnt3  cnt4  status

1   4       4       4     4       P

2   4       5       4     4       F

3   4       4     NA    4       P

4   NA    4       3     4       F

i tried with UPDATE statemnt with CASE WHEN conditions and DECODE, but couldnt succeed, Can anyOne please help

This post has been answered by BluShadow on May 28 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 25 2015
Added on May 28 2015
21 comments
2,756 views