Asked • 03/18/19

Swapping column values in Oracle?

I was solving one of the puzzles and came across swapping column values using DML queries: SELECT * FROM TEMP_TABLE; ID1, ID2 -------- 20, 15 20, 15 20, 15 Solution is mathematical calculation: UPDATE TEMP_TABLE SET ID1=ID1+ID2; UPDATE TEMP_TABLE SET ID2=ID1-ID2; UPDATE TEMP_TABLE SET ID1=ID1-ID2; Now, I am trying to figure out whether this can be applied to Strings or not, please suggest. SELECT * FROM TEMP_TABLE_NEW; ID1, ID2 -------- ABC, XYZ ABC, XYZ ABC, XYZ

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.