Tutorial 5 - The Oracle "REPLACE" Function

Here's the definition of "REPLACE" according to the Oracle website located at "http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions134.htm".






An example of using the replace function from a column (say car_names) from a table (say cars) might look like this:


SELECT REPLACE('FORD','F','CRAPPY F') CAR_NAMES FROM CARS;

Translated, this statement says, replace the letter "F" from FORD with "CRAPPY F" to make the new string "CRAPPY FORD" wherever "FORD" exists in the column "CAR_NAMES" from the table "CARS".

The replace function is also useful for removing commas or decimal points that might not be needed from the string.

-Andy


0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home