w3resource

Oracle TRANSLATE ... USING function

Description

The Oracle TRANSLATE ... USING converts character string into the character set specified for conversions between the database character set and the national character set.

Uses of Oracle TRANSLATE ... USING Function
  • Character Set Conversion: Convert a string from the database character set to the national character set.

  • Database Interoperability: Facilitate data exchange between different character sets in a multilingual database environment.

  • Data Migration: Assist in the migration of data between databases with different character set configurations.

  • String Manipulation: Enable manipulation of strings for applications that require specific character set formats.

Syntax:

TRANSLATE ( char USING
          { CHAR_CS | NCHAR_CS }
          )

Parameters:

Name Description Data Types
char is the expression to be converted.
CHAR_CS converts char into the database character set. VARCHAR2
NCHAR_CS converts char into the national character set. NVARCHAR2

Examples: Oracle TRANSLATE_USING function

SQL> CREATE TABLE table_1 (char_col  CHAR(20),
  2                   nchar_col nchar(20));

Table created.

SQL> INSERT INTO table_1
  2    VALUES ('Hello', N'Welcome');

1 row created.

SQL> SELECT * FROM table_1;

CHAR_COL             NCHAR_COL
-------------------- --------------------
Hello                Welcome

SQL> UPDATE table_1 SET
  2    nchar_col = TRANSLATE(char_col USING NCHAR_CS);

1 row updated.

SQL> UPDATE table_1 SET
  2    char_col = TRANSLATE(nchar_col USING CHAR_CS);

1 row updated.

SQL> SELECT * FROM table_1;

CHAR_COL             NCHAR_COL
-------------------- --------------------
Hello                Hello

Previous: TRANSLATE
Next: TRIM



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/oracle/character-functions/oracle-translate_using-function.php