Update only in one column character - Oracle

Asked

Viewed 872 times

1

I have a column, where this written R. TEST, I just need to make a correction leaving for STREET. TEST, how to make this change in the Oracle database.

2 answers

1


The expression below will update all COLUMN values where the value starts with R.:

UPDATE TABELA
SET    COLUNA = REPLACE(COLUNA,'R. ','RUA. ')
WHERE  COLUNA   LIKE 'R. %';
  • That’s exactly what I needed, thank you very much @Onosendai.

  • Always a pleasure to help, @Diogodgo.

1

Good do not know the DBA rules of your system, but it is not recommended this kind of column name.

If your question concerns the registration of the Address/Lougradouro column:

update table
    set [NomeDaColunaDeEndereco] = 'Rua Teste'
[WHERE id = x];

If your question refers to the column name:

alter table
   tabela
rename column
   [R.TESTE]  
TO
   RUATESTE;

I hope I’ve helped in some way.

  • Ola Tábata, I refer to the same record, in case I have a single line that is written this way, I need to correct only the letter R to STREET. It would not be the case of alter table no.

  • 1

    Thank you Diogo, I got it wrong. : ) Well Ono gave a good solution if you do not have the ID, I thought of a specific record :(

  • But I appreciate the help anyway.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.