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!

Need Help writing a sub query

764853Jan 10 2011 — edited Jan 10 2011
Our Environment - Oracle 10g

Hi All
Need help to write a sub query to acheive the below is the sample data using which iam trying to replace the column values in the table based on two other columns in the same table

Sample Data

ClaimNo LineNo Flag Procedurecode
100 01 N MN4567
100 02 Y 7863
100 03 N MN8976
100 04 Y 9000
101 01 Y 8954
101 02 N MN6754
101 03 N MN7654
101 04 Y 8976
102 01 Y 1234
102 02 Y 2345
102 03 Y 3456
102 03 Y 4567

Every ClaimNo column has multiple rows of data.But if procedurecode column for a claimNo starts with MN then all the associated values with the claimno for the flag column should change to N

So the data should become like below

ClaimNo LineNo Flag Procedurecode
100 01 N MN4567
100 02 N 7863
100 03 N MN8976
100 04 N 9000
101 01 N 8954
101 02 N MN6754
101 03 N MN7654
101 04 N 8976
102 01 Y 1234
102 02 Y 2345
102 03 Y 3456
102 03 Y 4567


Thanks
This post has been answered by Sayan Malakshinov. on Jan 10 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 7 2011
Added on Jan 10 2011
8 comments
123 views