Oracle Update issues

Source: Internet
Author: User
Tags translate function

Little brother to encounter an Oracle update problem, ask you to help:

There are several records in the Zz_file, similar in format:

(zz01 zz02)

gpyi010 apyi/gpyi010

gpyi020 apyi/gpyi020

.....

The younger brother wants to zz01 the Gpy the record which begins with the $apyi to change into $gpyi

I tried the update zz_file set zz02[1]= ' G ' where ...

Unsuccessful, do you know how to change part of the content of the method?

Thanks for the first.

Try a translate function.

FUNCTION TRANSLATE

(String_in in VARCHAR2,

Search_set in VARCHAR2,

Replace_set VARCHAR2)

Return varchar2//Find a string and replace her with another string.

However, if you have more than one search_set in the Zz02 field, it will be replaced.

Update AA

Set b= translate (b, ' apyi ', ' gpyi ')

where substr (b,6,10) = ' gpyi ';

Good

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.