Lijkaan
Lijkaan

Reputation: 3

Query to Replace a value with a different value in a table

I would like to replace a value Test to Mess in Column A in a table T where the value is Var in Column B in the same table.

Please someone help me with the query as I'm new to Oracle.

Upvotes: 0

Views: 30

Answers (1)

EntGriff
EntGriff

Reputation: 875

This is very easy, try this:

UPDATE t
SET A =  REPLACE(A, 'Test', 'Mess')
WHERE B = 'Var';

or if You want not replace, but full text update in A column, you can make like this :

UPDATE t
SET A =  'Mess'
WHERE B = 'Var' and A = 'Test';

Upvotes: 1

Related Questions