C # Obtains and writes the Chinese and English character set problems in the Oracle database

Source: Internet
Author: User

background :

Development language: C #

Development tools: VS2010

A-party Oracle database: Chinese Character set

B-party Oracle database: English Character set

Delivery Mode: WebService method (take data, and put the extracted data into the DataTable, loop back to write to the B-side of the stored procedure)

Questions :

From a-side library to get the data inserted into the B-side library written in the stored procedure, to the B-side database, the Chinese characters are garbled (more question marks)

Workaround :

Method One: Use Oracle's conversion function to utl_raw the data from the A-side library initially. Cast_to_raw convert the field, which is select Utl_raw. Cast_to_raw (a) from a

Stored procedures for receiving data in B-side libraries should be parsed with the UTL_RAW.CAST_TO_VARCHAR2 () function and inserted into the B-party library.

Result: No data received from B-side library

Method A failure reason, followed by the direction of direct query select Utl_raw. Cast_to_raw (a) from a in a party library is displayed binary code, but the queried data can not be stored in the DataTable, into the DataTable into a system.data[], the display is not a string caused by the detection, The idea of converting a converted data query into a string

Method Two:

Use the Oracle character intercept function to convert to a string (To_char is not a line), with the statement: Select SUBSTR (Utl_raw. Cast_to_raw (a), 0,length (Utl_raw. Cast_to_raw (a))) The stored procedure is still inserted into the B-side library with the UTL_RAW.CAST_TO_VARCHAR2 () function after the data is received from the A;b Party library.

Results: Chinese characters show normal in B-side library.

C # Obtains and writes the Chinese and English character set problems in the Oracle database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.