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!

Swap values between two columns

784247May 10 2011 — edited May 10 2011
I have a table MEMBERS_SYSTEMS_ID of which three columns are ID, B1, B2.
I need to swap the values between B1 & B2 for particular values of ID.
Iam trying the following but it doesnt work , Please help fix this +[If you can also tell why my SQL is not working that would be great]+

BEGIN
DECLARE temp varchar(50)
UPDATE MEMBERS.MEMBERS_SYSTEMS_ID

SET temp =B2,
B2 =B1,
B1 =temp
WHERE ID IN ('85','86');
END
This post has been answered by John Spencer on May 10 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2011
Added on May 10 2011
5 comments
9,748 views