Week 7 Lecture 2 Globalization Support in the Database.

Slides:



Advertisements
Similar presentations
CIT 613: Relational Database Development using SQL Revision of Tables and Data Types.
Advertisements

Session 2Introduction to Database Technology Data Types and Table Creation.
9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Data Definition Language (DDL)
NorCal OAUG Training Day, Pres 5.09John Peters, JRPJR, Inc.1 So you want Multiple Languages in your Oracle E-Business Suite John Peters JRPJR, Inc.
20 Copyright © 2008, Oracle. All rights reserved. Globalization.
Introduction to Structured Query Language (SQL)
Lecture-5 Though SQL is the natural language of the DBA, it suffers from various inherent disadvantages, when used as a conventional programming language.
1 A GUIDE TO ORACLE8 CHAPTER 2: Creating and ModifyingDatabaseTables 2.
Introduction to Structured Query Language (SQL)
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Creating Database Tables © Abdou Illia MIS Spring /21/2015.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
SQL Overview Defining a Schema CPSC 315 – Programming Studio Spring 2008 Project 1, Lecture 3 Slides adapted from those used by Jeffrey Ullman, via Jennifer.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
CHARACTERS Data Representation. Using binary to represent characters Computers can only process binary numbers (1’s and 0’s) so a system was developed.
Oracle Data Definition Language (DDL)
Introduction to Access By Mary Ann Chaney and Alicia Harkleroad.
ASP.NET Programming with C# and SQL Server First Edition
Chapter 2 Basic SQL SELECT Statements Oracle 10g: SQL.
Database Design lecture 3_1 1 Database Design Lecture 3_1 Data definition in SQL.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 7 PL/SQL Packages.
Oracle Data Definition Language (DDL) Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
1 Creating and Modifying Database Objects. 2 An Oracle database consists of multiple user accounts Each user account owns database objects Tables Views.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
1 A Guide to SQL Chapter 2. 2 Introduction Mid-1970s: SQL developed under the name SEQUEL at IBM by San Jose research facilities to be the data manipulation.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
BTM 382 Database Management Chapter 7 Introduction to Structured Query Language (SQL) Chitu Okoli Associate Professor in Business Technology Management.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 14 Globalization Support in the Database.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
SCUHolliday - coen 1788–1 Schedule Today u Modifications, Schemas, Views. u Read Sections (except and 6.6.6) Next u Constraints. u Read.
A Skills Approach Access 2010 Working with Tables © 2012 The McGraw-Hill Companies, Inc. All rights reserved Chapter 2.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Siebel CRM Unicode Conversion – The DBA Perspective Brian Hitchcock OCP 8, 8i, 9i DBA Sun Microsystems DCSIT Technical.
Data Types Lesson 4. Skills Matrix Table A table stores your data. Tables are relational in that they are organized as rows and columns (a matrix). Each.
Oracle 11g: SQL Chapter 4 Constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
16 Copyright © 2006, Oracle. All rights reserved. Using Globalization Support.
Conversion Functions.
Data types  CHAR (size): This data type is used to store character strings values of fixed length. The size in brackets determines the number of characters.
8 Copyright © 2004, Oracle. All rights reserved. Managing Schema Objects.
SQL CREATING AND MANAGING TABLES lecture4 1. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns ViewLogically.
1 Chapter 2: Creating and Modifying Database Objects.
Sql DDL queries CS 260 Database Systems.
A Guide to SQL, Eighth Edition Chapter Eight SQL Functions and Procedures.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Aliya Farheen October 29,2015.
2 Copyright © 2004, Oracle. All rights reserved. Using Globalization Support.
Understanding Character Encodings Basics of Character Encodings that all Programmers should Know. Pritam Barhate, Cofounder and CTO Mobisoft Infotech.
Academic Year 2015 Autumn. MODULE CC2006NI: Data Modelling and Database Systems Academic Year 2015 Autumn.
Lecture # 24 Introduction to SQL Muhammad Emran Database Systems.
Oracle9i Developer: PL/SQL Programming Chapter 6 PL/SQL Packages.
7 Copyright © 2004, Oracle. All rights reserved. Managing Schema Objects.
4 Copyright © 2009, Oracle. All rights reserved. Using Conversion Functions and Conditional Expressions.
3 A Guide to MySQL.
Creating Database Objects
Introduction To Oracle
Using Globalization Support
SQL and SQL*Plus Interaction
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
ORACLE SQL Developer & SQLPLUS Statements
DATABASE MANAGEMENT SYSTEM
SQL OVERVIEW DEFINING A SCHEMA
Oracle Data Definition Language (DDL)
Contents Preface I Introduction Lesson Objectives I-2
Creating Database Objects
SQL (Structured Query Language)
Varying Character Lengths
Presentation transcript:

Week 7 Lecture 2 Globalization Support in the Database

Learning Objectives  Examine how globalization support is implemented in the database  Use globalization parameters and variables  View globalization support information in data dictionary views

National Language Support vs. Globalization Support  National Language Support (NLS) makes it possible for tables to store data from multiple languages  Globalization support allows you to design a database that supports users from many nationalities by converting data to each user’s native language  NLS is a subset of Globalization support

Introduction to Globalization Support  Oracle now has support for the Euro  ALTER TABLE MODIFY can now convert a CHAR column to an NCHAR column  New Oracle-supplied packages support conversion of BFILE data into NLS character data when loading a NCLOB column  Oracle’s database structure now supports storing data in Unicode

Language-Dependent Behavior in the Database Sorting, date formatting, currency formatting, and similar things must be altered  Behind the scenes, the database stores data using bytes, as it does with English  Even though the database stores data in any language, it requires that you store SQL and PL/SQL in English  The database can convert data to and from different languages, so that each client sees the appropriate language

Language-Dependent Behavior in the Database An example database supporting 3 clients in different languages: Database Spanish Client French Client English Client Database Translations

Using NLS Parameters and Variables  An Oracle9i database has a base language called its database character set  A second language, called the national character set, can be used to store data in columns that are defined as one of the three NLS data types  Both character sets are designated when you create the database by specifying the CHARACTER SET and NLS CHARACTER SET  After the database is created, you cannot change these two parameters  Use initialization parameters to fine-tune the database’s behavior regarding the NLS character set you have chosen

Example Character Sets Three variations of Japanese character sets: JA16EUC JA16EUCTILDE JA16EUCYEN Simplified Chinese: ZHS16CGB Traditional Chinese ZHT16CCDC American: US7ASCII German: D7DEC French: F7DEC Latin/Arabic: AR8APTEC715 Latin/Hebrew IW8ISO8859P8

Different Types of Character Sets  UTF8 is a universal language character set  Using the UTF8 character set can simplify translations from one language to another when the database has multilingual clients  US7ASCII is a single-byte character set  Many other character sets are single-byte character sets, especially for languages similar to English, such as French, Latin, Spanish, Italian, and many more Western European languages

Different Types of Character Sets  UTF8 is a multibyte character set  A multibyte character set can be either fixed-length or variable-length  A fixed-length multibyte character set uses a fixed number of bytes for each character in the character set  Calculating the length of a data string is easier with fixed-length character sets  A variable-length multibyte character set uses a variable number of bytes to represent one character in the character set  Variable-length character sets save space but take longer for processes such as calculating the length of a data string

Adjusting Globalization Initialization Parameters  Many NLS-related initialization parameters in Oracle9i  All of them affect how the database handles national language data  In addition to being modified in the init.ora file, NLS initialization parameters can be modified at two levels: SQL level: Changing the value of an initialization parameter within an SQL function or an SQL statement alone. Use special NLS clauses to accomplish this. Session level: Changing the value of an initialization parameter in the current session only. Use the ALTER SESSION command to do this.  The value of a parameter at the narrower level always overrides the value of the same parameter at the broader level

Database Properties Affecting Language  NLS_LANGUAGE:  Affects the language used for messages, day and month names, and sorting order, among other things  NLS_TERRITORY:  Affects how dates are formatted, what currency is used by default, and the numbering format of days and weeks  NLS_CURRENCY:  Changes the symbol used for currency (for example, “$” is the default when NLS_TERRITORY is AMERICA)

More Database Properties Affecting Language  NLS_DATE_FORMAT:  Changes the default format of dates, as set by NLS_TERRITORY. The format defines the expected format of dates in the TO_DATE function.  NLS_DATE_LANGUAGE:  Changes the spelling of days, months, and abbreviations for time and date, such as AM, PM, and AD. The default for this parameter is defined by the NLS_LANGUAGE parameter.

More Database Properties Affecting Language  NLS_ISO_CURRENCY:  Changes the international currency symbol set by the NLS_TERRITORY parameter.  NLS_NUMERIC_CHARACTERS:  Changes the symbols used as decimals and separators in numbers. The default value is set by the NLS_TERRITORY parameter.  For example, in the AMERICA territory, a comma (,) is the separator and a period (.) is the decimal point. In the FRANCE territory, a period (.) is the separator and a comma (,) is the decimal point.

More Database Properties Affecting Language  NLS_SORT:  Changes the method used to sort character data.  Default is set by the NLS_TERRITORY parameter, so that sorting is done according to the language of the data.  BINARY is the default for the NLS_TERRITORY of AMERICA; however, other values, such as JAPANESE, reflect the name of the language.  In the case of the English language, the order of the alphabet is reflected by the order of the numeric values stored for the symbol for each letter, so the sort is based on the numerical values of the characters, hence the name BINARY.

Using NLS Parameters in SQL  Can add NLS parameters to the TO_CHAR,TO_DATE, and TO_NUMBER functions to use language-dependent values  For example, the TO_CHAR command has the following syntax: TO_CHAR(,’ ’,’ ’)  Can specify up to three parameters in the TO_CHAR function to modify the default values set up by the NLS_TERRITORY parameter  You must use the appropriate placeholder in the format for each parameter

Using NLS Parameters in SQL NLS_CURRENCY: Sets the symbol of the local currency. Placeholder is L. NLS_NUMERIC_CHARACTERS: Sets the symbols for the decimal point (placeholder is D) and group separator (placeholder is G). NLS_ISO_CURRENCY: Sets the symbols for the international (ISO) currency. Placeholder is C.

Using NLS Parameters in SQL  You can specify the language-dependent sort order within the ORDER BY clause, which has the following syntax: ORDER BY NLSSORT(,’NLS_SORT= ’);  ORDER BY clause sorts by using the results of the NLSSORT function that changes a column’s data into an alphanumeric string that sorts according to the language-dependent properties of whatever language you specify

Changing NLS Parameters in Your Session  Can also change NLS parameters so that all queries use your session settings and no one else using the database is affected  Best way to do this is by adjusting the two primary parameters (NLS_LANGUAGE and NLS_TERRITORY)  This is done with the ALTER SESSION command  Initialization parameters in the init.ora file should be set up to handle the NLS requirements for typical requests and reports

Viewing NLS Parameters in Data Dictionary Views NLS_DATABASE_PARAMETERS Lists NLS parameter settings for the database, including NLS_CHARACTER_SET  NLS_INSTANCE_PARAMETERS  Lists NLS parameter settings for the database instance. Only shows values that have been set in the init.ora file. Parameters left to default are shown as null values  NLS_SESSION_PARAMETERS  Lists NLS parameters in force for the current session. Does not include NLS_CHARACTER_SET  V$NLS_PARAMETERS  Lists current values of NLS parameters  V$NLS_VALID_VALUES  Lists all valid values for these NLS parameters: CHARACTERSET, LANGUAGE, SORT, TERRITORY

Final Points About NLS  With few exceptions, you choose the default character set and the NLS character set at database creation and never change them.  Other NLS parameters can be modified by changing the initialization parameters, adjusting them in your session, or adding them to an SQL statement.

Lecture Summary  National Language Support (NLS) allows one database to store multiple languages of data  Globalization support includes NLS support and more capabilities aimed at producing a multilingual database  Globalization support has improved with new features in Oracle9i  SQL and PL/SQL must be entered in English, even if the native language is not English

Lecture Summary  The database character set is the default character set used for all but NLS data types  NLS data types are NCHAR, NVARCHAR2, and NCLOB  The national character set is used for NLS data types  Character sets are defined when the database is created  A character set is a map of characters to machine language codes

Lecture Summary  UTF8 is a universal language character set capable of supporting all languages supported by Oracle9i  Character sets are either single-byte or multibyte.  Multibyte character sets are either fixed-length or variable- length  NLS-related initialization parameters can be set in the init.ora file, a session, or a specific SQL statement  Use the Instance Manager to examine NLS parameters and their definitions

Lecture Summary  Add NLS parameters to the TO_CHAR,TO_DATE, and TO_NUMBER functions to use values other than defaults  Use language-dependent sorting through the NLSSORT function in the ORDER BY clause  Number formatting can be done with the TO_CHAR function and includes changing the currency, decimal point, and group separator symbols  American English and French sorting orders are different

Lecture Summary  Adjust sorting order by including NLSSORT in the ORDER BY clause  The NLS_SESSION_PARAMETERS view lists NLS parameters currently set for your session  Changing NLS_LANGUAGE does not translate text data into another language  V$NLS_VALID_VALUES lists all valid values for some of the NLS parameters