To select data into str, use the following simple query: The variable size of an NCHAR variable is specified as a byte count, the same way that ordinary C variables are. Pro*C/C++ treats variables declared this way as of the character set specified by the environment variable NLS_NCHAR. You can accomplish the same thing by entering NLS_CHAR=str on the command line, and coding in your application: In this example, consists of double-byte characters which are in the National Character Set JA16EUCFIXED, as defined by the variable NLS_NCHAR. NCHAR_CS is the name of the National Character Set.Ĭhar character set is nchar_cs *str = " " Then you are able to store National Character Set data in those variables. You insert the clause " CHARACTER SET NCHAR_CS" in character variable declarations. You specify which host variables hold National Character Set data. Use NLS_LOCAL=NO for all new applications. The database, rather than SQLLIB provides blank padding and stripping, and setting of indicator variables. If you set NLS_LOCAL to NO (the default), Oracle8 supports multi-byte strings with the new semantics (the letter "N" will be concatenated in front of the quoted string). SQLLIB provides blank padding and stripping, sets indicator variables, etc. When you set the command-line option NLS_LOCAL to YES, multi-byte support with earlier semantics will be provided by SQLLIB (the letter "N" is stripped from the quoted string), as in Oracle7. Pro*C/C++ supported multi-byte NCHAR host variables in earlier releases, with slightly different semantics. You use these datatypes only in relational columns. They are NCHAR and NVARCHAR2 (also known as NCHAR VARYING). Two internal database datatypes are for multi-byte character data. For more information about NLS, see Oracle8 Application Developer's Guide. You can even pass NLS parameters to the TO_CHAR, TO_DATE, and TO_NUMBER functions. And, you can use the function NLSSORT to specify WHERE-clause comparisons based on linguistic rather than binary ordering. You can use the functions NLS_INITCAP, NLS_LOWER, and NLS_UPPER to handle special instances of case conversion. These functions have the same syntax as the INSTR, LENGTH, and SUBSTR functions, respectively, but operate on a per-byte basis rather than a per-character basis. For example, you can declare foreign-language character variables and pass them to string functions such as INSTRB, LENGTHB, and SUBSTRB. The Pro*C/C++ Precompiler fully supports all the NLS features that allow your applications to process foreign-language data stored in an Oracle8 database. Use the ALTER SESSION statement as follows: Setenv NLS_LANG French_France.WE8ISO8859P1ĭuring an Oracle8 database session you can change the values of NLS parameters. For example, on UNIX using the C shell, you might define NLS_LANG as follows: You define NLS_LANG as an environment variable (or the equivalent on your system). It also includes codes that control communication with the terminal. An encoding scheme (usually called a character set or code page) is a range of numeric codes that corresponds to the set of characters a terminal can display. Where language specifies the value of NLS_LANGUAGE for the user session, territory specifies the value of NLS_TERRITORY, and character set specifies the encoding scheme used for the terminal. You can control the operation of language-dependent NLS features for a user session by specifying the parameter NLS_LANG as follows: NLS_TERRITORY specifies the default values for territory-dependent features, which include NLS_LANGUAGE specifies the default values for language-dependent features, which include The main parameters are NLS_LANGUAGE and NLS_TERRITORY. Table 4-1 shows what each NLS parameter specifies. Default values for these parameters can be set in the Oracle8 initialization file. You control the operation of language-dependent features by specifying various NLS parameters. Thus, NLS allows users around the world to interact with Oracle8 in their native languages. With NLS, number and date formats adapt automatically to the language conventions specified for a user session. It also lets your applications run in different language environments. Oracle8 provides National Language Support (NLS), which lets you process single-byte and multi-byte character data and convert between character sets. How does Oracle8 deal with such dissimilar languages? These languages can require at least 16 bits (two bytes) to represent each character.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |