w3resource

Oracle TRANSLATE ... USING function

Description

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

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



Follow us on Facebook and Twitter for latest update.