I am trying to remember how form a proper REPLACE
statement in Oracle SQL.
In essence, I need to perform a REPLACE
over a few thousand records in which column1
and column2
may contain a value of '14'
. If they do, I need to replace it with just a space character.
I know that the syntax is something like the following, but I can't seem to get it quite right:
UPDATE TABLE
SET ('column1', 'column2') = REPLACE(?????????????)
WHERE 'column1' IN ('14') AND 'column2' NOT LIKE ('4%')
Any help would be appreciated.
You can use REPLACE in an UPDATE statement.
The stored function may not modify database tables. It cannot execute an INSERT, DELETE, or UPDATE statement. A stored function that is called remotely or through a parallelized action may not read or write the values of package variables. The Oracle Server does not support side effects that cross user sessions.
An Oracle REPLACE Function is used to replace the string with a given string as the name suggests. It accepts a search string and replaces it with another given string but pattern-wise. It returns CHAR with every replaced with replacement string for the search string.
UPDATE TABLENAME
SET COLUMN1 = ' ',
SET COLUMN2 = ' '
WHERE COLUMN1='14' OR COLUMN2='14';
Assuming Column[1,2] are of Character type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With