Use translate function in update statement : Translate « Char Functions « Oracle PL / SQL






Use translate function in update statement

 
SQL>
SQL>  create table nchar_samples(
  2      char_data  char(100),
  3      nchar_data nchar(100)
  4    )
  5    /

Table created.

SQL>
SQL>  insert into nchar_samples( nchar_data )
  2    values ( N'Some text' )
  3    /

1 row created.

SQL>
SQL>  update nchar_samples
  2       set char_data = translate( nchar_data using char_cs )
  3    /

1 row updated.

SQL>
SQL> drop table nchar_samples;

Table dropped.

SQL>
SQL> --

 








Related examples in the same category

1.TRANSLATE() returns a string where all occurrences of the from_template are replaced with corresponding characters in the to_template.
2.from_template argument can contain more characters than to_template.
3.all dashes ("-") were dropped from the translated string, and the digit "9" was translated into an asterisk.
4.Translate: replaces a string character by character
5.TRANSLATE(x, from_string, to_string): Converts all occurrences of from_string in x to to_string
6.Using the TRANSLATE() Function: to encode and decode
7.Shifts the lowercase as well as uppercase characters in a column
8.TRANSLATE(): convert numbers
9.TRANSLATE('555-143-3344', '1234567890','XXXXXXXXXX') phone