Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6093641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:35:01+00:00 2026-05-23T12:35:01+00:00

Can any one tell me the difference between replace function & translate function of

  • 0

Can any one tell me the difference between replace function & translate function of Oracle?

I read somewhere that replace makes the changes in database permanent where translate does not, is it correct?

Can any one show the query which will prove that replace does changes permanently in database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:35:02+00:00Added an answer on May 23, 2026 at 12:35 pm

    The difference between REPLACE and TRANSLATE:

    • REPLACE substitutes one string for another string.
    • TRANSLATE substitutes characters in one set for those in another.
    • Neither TRANSLATE or REPLACE update the database.

    Here’s some examples:

    create table nada (id number(8), description nvarchar2(30));
    insert into nada values (1, "I like peanuts.");
    insert into nada values (2, 'Peanuts are not a nut.');
    insert into nada values (3, 'peanuts are a legume.');
    commit;
    select * from nada;
    
    Id Description
    -- ------------------------
     1 I like peanuts.
     2 Peanuts are not a nut.
     3 peanuts are a legume.
    

    REPLACE works like this:

    select replace(description, 'peanuts', 'tomatoes') from nada;
    

    gives:

    replace(description,'peanuts','tomatoes')
    --------------------------------------
    I like tomatoes.
    Peanuts are not a nut.
    tomatoes are a legume.
    

    Just the word ‘peanuts’ is replaced with ‘tomatoes’. It’s case sensitive so ‘Peanuts’ isn’t replaced.

    TRANSLATE works like this:

    select translate(description, ' .', '_!') from nada;
    
    translate(description, ' .', '_!')
    ----------------------------------
    I_like_peanuts!
    Peanuts_are_not_a_nut!
    peanuts_are_a_legume!
    

    All spaces are changed to underscores and all periods are changed to bangs!


    Neither TRANSLATE or REPLACE update the database. They just change the value
    in a statement. Of course, you can use that value to update the database if
    you want. For example:

    select replace(description, 'peanuts', 'tomatoes') from nada;
    select * from nada;
    

    The table is still the same:

    Id Description
    -- ------------------------
     1 I like peanuts.
     2 Peanuts are not a nut.
     3 peanuts are a legume.
    

    If you want to change the table, put it in an UPDATE or INSERT statement,
    such as:

    update nada set description = replace(description, 'peanuts', 'tomatoes');
    commit;
    

    Now it’s changed:

    select * from nada;
    
    Id Description
    -- ------------------------
     1 I like tomatoes.
     2 Peanuts are not a nut.
     3 tomatoes are a legume.
    

    Now if you want to fix ‘Peanuts’ too, you can use REGEXP_REPLACE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can any one tell me the difference between TTL and Keep alive in sockets
Can anyone please tell me whats the exact difference between App id and api
Can anyone tell me the difference between ASCII English Text and ASCII C Program
Possible Duplicate: What's the difference between a header file and a library? Can anyone
I need to represent some data that has a key and one or more
I am trying to create a chrome extension using HTML5 WebSockets and can't get
I'm trying to build an XPCOM extension for Firefox, and I need to build
I just wrote my first nodejs program using the node-mongodb-native driver. I used the
If I run this piece of code through closure compiler or uglifyjs, this.init is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.