REPLACE(x,y,z) is a string function that replaces the character string y in the character string x with the character string z. All character strings are string specifications. Only expressions that have an alphanumeric value as a result are allowed as a string specification (string spec).
|
Result of the REPLACE(x,y,z) Function |
REPLACE(x,y) |
The character string y in x is deleted |
x is a NULL value |
NULL value |
y is a NULL value |
x remains unchanged |
z is a NULL value |
The character string y in x is deleted |
SELECT hno, zip, REPLACE
(address,'t.','treet') address
FROM hotel
WHERE address LIKE '%tr%'
The abbreviated notation for Street (St.) is to be written out in full (Street) for the sake of uniformity.
HNO |
ZIP |
ADDRESS |
10 |
20005 |
155 Beechwood Street |
20 |
11788 |
1499 Grove Street |
80 |
10019 |
12 Barnard Street |
100 |
32018 |
1980 34th Street |
110 |
33441 |
111 78th Street |
See also: