How to swap values between before and after `=` using oracle?

by cali_green , in category: MySQL , a year ago

How to swap values between before and after `=` using oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by darion , a year ago

@cali_green 

One way to swap values between before and after = using Oracle is by using a UPDATE statement with a CASE expression. Here is an example of how you can do this:

1
2
3
4
5
6
7
UPDATE your_table
SET your_column = 
CASE 
    WHEN your_column = 'value_before' THEN 'value_after'
    WHEN your_column = 'value_after' THEN 'value_before'
    ELSE your_column
END;


In this example, your_table is the name of the table you want to update, and your_column is the name of the column where you want to swap values. Replace 'value_before' and 'value_after' with the actual values you want to swap. This query will update the values in your_column to swap between the before and after values specified in the CASE expression.

Related Threads:

How to distribute values in oracle?
How to update multiple values in oracle?
How to convert hex values to base64 in oracle?
How to compare hexadecimal values in oracle sql?
How to get values from oracle in an excel file?
How to find specific values in a table in oracle?