EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

Oracle CONVERT

Secondary Sidebar
Oracle Tutorial
  • Advanced
    • Timestamp to Date in Oracle
    • Oracle Golden Gate
    • Oracle Virtual Machine
    • Oracle Describe Table
    • Oracle Clauses
    • Oracle Having Clause
    • Oracle?Primavera
    • Oracle FOREIGN Key
    • PIVOT in Oracle
    • Oracle Alter Table
    • Oracle Queries
    • Oracle Views
    • Oracle Window Functions
    • Oracle String Functions
    • Oracle Date Functions
    • Oracle Analytic Functions
    • Oracle Aggregate Functions
    • Select in Oracle
    • INSERT in Oracle
    • DISTINCT in Oracle
    • Function in Oracle
    • Oracle GROUP_CONCAT
    • Oracle INSTR()
    • Oracle CONVERT
    • Oracle LENGTH()
    • Oracle EXISTS
    • Oracle REPLACE()
    • Oracle MERGE
    • Oracle LEAD()
    • Oracle EXTRACT()
    • Oracle LISTAGG()
    • Oracle SYS_CONTEXT()
    • Oracle COALESCE
    • Oracle NVL()
    • Oracle SYSDATE()
    • Oracle?Date Format
    • Oracle SYS_GUID()
    • Oracle WILDCARDS
    • Oracle Synonyms
    • Oracle Subquery
    • BETWEEN in Oracle
    • FETCH in Oracle
    • Oracle Index
    • Oracle Function-based Index
    • Oracle UNIQUE Index
    • Oracle Bitmap Index
    • Oracle Column
    • Oracle Triggers
    • Oracle Procedures
    • Sample Database for Oracle
    • Oracle LIKE Operator
    • ORDER BY in Oracle
    • Oracle ORDER BY DESC
    • GROUP BY in Oracle
    • Oracle GROUP BY HAVING
    • Oracle Aliases
    • Table in Oracle
    • Oracle Temporary Table
    • Oracle? Table Partition
    • Oracle rename table
    • Oracle CTE
    • Cursor in Oracle
    • Oracle LOCK TABLE
    • Oracle Tablespace
    • Oracle CARDINALITY
    • Oracle REGEXP
    • Oracle REGEXP_REPLACE
    • Oracle to_date
    • JSON in Oracle
    • Oracle COMMIT
    • Oracle GRANT
    • Oracle MD5
    • Oracle ROLLBACK
    • Oracle Users
    • Oracle TIMESTAMP
    • IF THEN ELSE in Oracle
    • Oracle While Loop
    • Oracle Clone Database
    • Oracle Backup Database
    • Oracle? XML
    • Oracle XMLAGG
    • Oracle XMLTABLE
    • Oracle Performance Tuning
    • Oracle B Tree Index
    • Oracle fusion
    • Oracle ebs
    • Oracle GRC
    • Oracle ERP
    • Oracle ASM
    • Oracle Cloud
    • Oracle HCM Cloud
    • Oracle Integration Cloud
    • Oracle Jinitiator
    • Oracle pathfinder
    • Oracle VirtualBox
    • Oracle Weblogic Server
    • Oracle decode
    • Oracle Exadata
    • Oracle ZFS
    • Oracle? utilities
    • JDBC Driver for Oracle
    • Oracle? DBA Versions
    • Oracle DBA Salary
  • Basic
    • Oracle Marketing Cloud
    • What is Oracle?
    • Career in Oracle
    • How to Install Oracle
    • Oracle Versions
    • What Is Oracle Database
    • Oracle Data Warehousing
    • Oracle Warehouse Builder
    • Career In Oracle Database Administrator
    • Career In Oracle DBA
    • What is Oracle RAC
    • Oracle DBA
    • Oracle? Vanderbilt
    • What is RMAN Oracle
    • Oracle Database Administration
    • Oracle Operators
    • Oracle Constraints
    • Oracle number
    • Oracle Data Types
    • Oracle UNIQUE Constraint
    • Oracle Check Constraint
  • Joins
    • Joins in Oracle
    • Inner Join in Oracle
    • Oracle Cross Join
    • Left Join in Oracle
    • OUTER Join in Oracle
    • Oracle Full Outer Join
    • Natural Join in Oracle
    • Oracle Self Join
    • Oracle hash join
    • Oracle? Update with Join
  • Oracle SET Operators
    • UNION in Oracle
    • Oracle UNION ALL
    • INTERSECT in Oracle
    • MINUS in Oracle
  • Interview Questions
    • Oracle Interview Questions
    • Oracle Apps Interview Questions
    • Oracle Apps Technical Interview Questions
    • Oracle Database Interview Questions
    • Oracle Forms Interview Questions
    • Oracle PL/SQL Interview Questions
    • Oracle RAC Interview Questions
    • Oracle SOA Interview Questions

Related Courses

Oracle Course Training

Oracle DBA Certification Course

MongoDB Certification Training

Home Data Science Data Science Tutorials Oracle Tutorial Oracle CONVERT

Oracle CONVERT

Definition of Oracle CONVERT Function

  • Oracle Convert Function is responsible for transforming a string value from one character set to a different one. Here, a character set can be defined as a set of characters and the way they are symbolized.
  • Generally, this convert () function is frequently implemented to accurately the data values stored in the server database having an erroneous character set.
  • This Oracle Convert() function can be implemented in some of the versions of Oracle such as Oracle 11g, Oracle 12c, Oracle 9i, Oracle 8i, and Oracle10g.
  • You should note that the Oracle Convert Function does not perform a conversion between the data types which might be thought by some of us. For the conversion of data type, we can choose other Oracle functions like TO_DATE, CAST, TO_NUMBER, and TO_CHAR.

Syntax:

The succeeding syntax code structure represents the Oracle Convert() function as:

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

CONVERT (string_expr,to_data_set {, from_data_set});

Let us explain the arguments of the convert() function accepting three arguments in Oracle as follows:

All in One Data Science Bundle(360+ Courses, 50+ projects)
Python TutorialMachine LearningAWSArtificial Intelligence
TableauR ProgrammingPowerBIDeep Learning
Price
View Courses
360+ Online Courses | 50+ projects | 1500+ Hours | Verifiable Certificates | Lifetime Access
4.7 (85,938 ratings)
  • String_expr: It denotes the string value whose character set needs to be converted. It includes the data types such as CHAR, NCHAR, VARCHAR2, NVHARCHAR2, CLOB, and NCLOB.
  • To_data_set: It denotes the character set name to which the string_expr is transformed to.
  • From_data_set: It defines the character set name that is applied to store the string_expr value in the server database. This argument can be said as an optional one that has the default value as the character set of the database.
  • Return value: This Oracle convert() function results from a string value in the converted character set.

Few extra notes to be noted about this function are listed below:

  • The return data type for the type parameters CHAR and VARCHAR2 are VARCHAR2.
  • The return data type for the type parameters NCHAR and NVARCHAR2 is NVARCHAR2.
  • For CLOB data type the return type is CLOB.
  • For NCLOB data type the return type is NCLOB.
  • The to_data_set and from_data_set may be either literal string or any table column in the database.

The communal character set consists of:

  • US7ASCII – Character set of US 7-bit ASCII
  • WE8EBCDIC1047 – IBM West European EBCDIC Code page 1047
  • WE8ISO8859P1 – Character set of ISO 8859-1 West European 8-bit
  • JA16SJISTILDE – Japanese Shift-JIS Character Set, compatible with MS Code Page 932
  • EE8MSWIN1250 – Microsoft Windows East European Code Page 1250
  • WE8MSWIN1252 – Microsoft Windows West European Code Page 1252
  • AL32UTF8 – Unicode 5.0 Universal character set UTF-8 encoding form.
  • UTF8 – Unicode 3.0 Universal Character set CESU-8 encoding form
  • ZHT16MSWIN950 – Microsoft Windows Traditional Chinese Code page 950
  • F7DEC – character set of DEC French 7-bit

How convert function works in Oracle?

  • Apart from the utility functions in SQL, conversion functions are also contained by the Oracle inbuilt function library. There may exist different scenarios where the SQL query supposes input in a definite data type and it accepts the output in an altered data type. In such situations, Oracle indirectly attempts to convert the unpredicted value to a well-matched data type that can be replaced in place, and application steadiness is not negotiated. Here, the data type conversion process is applied either explicitly performed by the programmer or by the Oracle performed implicitly.
  • The implicit data type of conversion functions on the basis of a matrix that showcases Oracle’s maintenance for the inner typecasting. Moreover, these procedures, Oracle provides type conversion functions that may be implemented in the queries for open conversion and structuring. As a matter of information, it is therefore suggested to execute conversion as an alternative of trusting software intelligence. Although, implicit conversion functions well, but to remove the skew probabilities where corrupt inputs could be problematic to typecast within.
  • Oracle has recommended that the convert () function must not be implemented in the prevailing release of their database. This is due to the reason that the data type on the return of output is present in a character data type such as CHAR, VARCHAR, VARCHAR2, NCHAR, NVARCHAR2, also CLOB, and NCLOB. When the from_data_set is not fixed to either the national character set or the database character set is not maintained.
  • Any from_data_set which is not included in one of these two character sets is not supported. Thus, values that are available neither in the database nor the national character set must be processed and can be kept BLOB or RAW.

Examples

Let us follow some illustrations as follows for this Oracle Convert() function:

1. Converting a string value from ANSI to UTF8 character sets as:

SELECT CONVERT ('GHJ', 'utf8', 'us7ascii') FROM dual;

Output:

Oracle Convert 1

Here, the above example explains conversion using Oracle Convert() function to a character set “GHJ” present in US7ASCII to the UTF8 character set. This result illustrates similar as importing an identical string from a US7ASCII database to a UTF8 database.

2. Converting the character set of a string value from Latin-1 to ASCII as:

SELECT CONVERT('Ó Ø Ä Ê Í A B E C D', 'US7ASCII','WE8ISO8859P1') FROM DUAL;

Output:

Oracle Convert 2

Here, the above instance clarifies conversion using Oracle Convert() function to a character set specified present in WE8ISO8859P1 to the US7ASCII character set. This result illustrates similar to importing an identical string from a WE8ISO8859P1 database to a US7ASCII database.

3. Oracle Convert function can transform a content file character sets directly in SQL, for instance as:

SELECT Convert('®Ã B','WE8EBCDIC500','US7ASCII')FROM DUAL;

Output:

Oracle Convert 3

Basically, the convert function is implemented to transform textual data from one particular character set to another destined character set. Following is an example showing the convert function to alter an unprintable English string alphabetical characters to equivalent US character set as follows:

SELECT CONVERT('à à Õ Ê Ø A B E C D0','US7ASCII','WE8ISO8859P1') FROM DUAL;

Output:

Oracle Convert 4

Here, the rude type English alphabets are converted to US7ASCII character set from the previous set defined as WE8ISO8859P1 set which is a character set denoting an ISO 8859-1 West European 8-bit set.

Conclusion

  • We have discussed an Oracle conversion function i.e. CONVERT(), which accepts string value in one character set and outputs the value in another specific character set.
  • This Oracle convert() function is advised only to execute when there is a need of correcting data value that has been kept or arranged in the incorrect character set.

Recommended Articles

This is a guide to Oracle CONVERT. Here we discuss the definition, syntax, parameters, and How the convert function works in Oracle? respectively. You may also have a look at the following articles to learn more –

  1. Oracle XMLType
  2. Oracle EXISTS
  3. Oracle Date Format
  4. Oracle XML
Popular Course in this category
Oracle Training (14 Courses, 8+ Projects)
  14 Online Courses |  8 Hands-on Projects |  120+ Hours |  Verifiable Certificate of Completion
4.5
Price

View Course

Related Courses

Oracle DBA Database Management System Training (2 Courses)4.9
All in One Financial Analyst Bundle- 250+ Courses, 40+ Projects4.8
0 Shares
Share
Tweet
Share
Primary Sidebar
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

SPSS, Data visualization with Python, Matplotlib Library, Seaborn Package

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

Special Offer - Oracle Training (14 Courses, 8+ Projects) Learn More