Skip to main content

I just want to change Character 18, but this goes and changes everything it finds related to Character 18.

 

Org. text  USMCAE*20L080M4D-0000

In the example below, the line of code returns the data as follows : USMCAE*2ELE8EM4D-EEEE

must be : USMCAE*20L080M4D-E000

 

select replace(mx.component_part, substr(mx.component_part, 18, 1), 'E') from prod_structure mx where mx.part_no like '___080___-__-__-___' and mx.component_part like 'US____*___080___-____'

Here is an example that only changes character 18 to E:

SUBSTR(mx.component_part,1,17) ||'E' ||SUBSTR(mx.component_part,19,1000)


I never thought of using the concatenation operator. Thank you very much @Tomas Ruderfelt 

Those who have other solutions can also write their solution suggestions to those here.


Reply