2 Copyright © 2004, Oracle. All rights reserved. Using Globalization Support.

Slides:



Advertisements
Similar presentations
9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Advertisements

Data Definition Language (DDL)
18 Copyright © Oracle Corporation, All rights reserved. Transporting Data Between Databases.
Objectives After completing this lesson, you should be able to do the following: Describe various types of conversion functions that are available in.
Copyright © 2007, Oracle. All rights reserved Using Single-Row Functions to Customize Output Modified: October 21, 2014.
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.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
20 Copyright © 2008, Oracle. All rights reserved. Globalization.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
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.
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Oracle9 i Datetime Functions Fresher Learning Program January, 2012.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Introduction to SQL Yong Choi School of Business CSU, Bakersfield.
Chapter 3 Single-Table Queries
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
1 Copyright © 2006, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
2 Copyright © Oracle Corporation, All rights reserved. Restricting and Sorting Data.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
4 Copyright © 2006, Oracle. All rights reserved. Restricting and Sorting Data.
10 Copyright © 2009, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
1 Copyright © 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
1 Single Table Queries. 2 Objectives  SELECT, WHERE  AND / OR / NOT conditions  Computed columns  LIKE, IN, BETWEEN operators  ORDER BY, GROUP BY,
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 14 Globalization Support in the Database.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
16 Copyright © Oracle Corporation, All rights reserved. Oracle9 i Datetime Functions.
Week 7 Lecture 2 Globalization Support in the Database.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
16 Copyright © 2006, Oracle. All rights reserved. Using Globalization Support.
Conversion Functions.
2 Copyright © 2004, Oracle. All rights reserved. Restricting and Sorting Data.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
Sql DDL queries CS 260 Database Systems.
Working with Columns, Characters, and Rows. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Apply the concatenation.
1 Copyright © Oracle Corporation, All rights reserved. Writing Basic SQL SELECT Statements.
2 Copyright © 2009, Oracle. All rights reserved. Restricting and Sorting Data.
5 Copyright © 2004, Oracle. All rights reserved. Managing Data in Different Time Zones.
Academic Year 2015 Autumn. MODULE CC2006NI: Data Modelling and Database Systems Academic Year 2015 Autumn.
Declaring PL/SQL Variables
Oracle & SQL. Oracle Data Types Character Data Types: Char(2) Varchar (20) Clob: large character string as long as 4GB Bolb and bfile: large amount of.
21 Copyright © 2009, Oracle. All rights reserved. Working with Oracle Business Intelligence Answers.
Gollis University Faculty of Computer Engineering Chapter Five: Retrieval, Functions Instructor: Mukhtar M Ali “Hakaale” BCS.
5 Copyright © 2009, Oracle. All rights reserved. Managing Data in Different Time Zones.
3 Copyright © 2004, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
3 Copyright © 2009, Oracle. All rights reserved. Using Single-Row Functions to Customize Output.
13 Copyright © 2004, Oracle. All rights reserved. Migrating SQL Statements.
4 Copyright © 2009, Oracle. All rights reserved. Using Conversion Functions and Conditional Expressions.
1 Copyright © 2004, Oracle. All rights reserved. Retrieving Data Using the SQL SELECT Statement.
3 A Guide to MySQL.
Creating Database Objects
Introduction To Oracle
CS 3630 Database Design and Implementation
Using Globalization Support
Oracle SQL.
Module 2: Creating Data Types and Tables
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Using the Set Operators
Contents Preface I Introduction Lesson Objectives I-2
Chapter 2: Creating And Modifying Database Tables
Using SQL*Plus.
Using the Set Operators
Creating Database Objects
Presentation transcript:

2 Copyright © 2004, Oracle. All rights reserved. Using Globalization Support

2-2 Copyright © 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to: Customize language-dependent behavior for the database and individual sessions Specify different linguistic sorts for queries Retrieve data that matches a search string ignoring case or accent differences Obtain Globalization support configuration information

2-3 Copyright © 2004, Oracle. All rights reserved. Globalization Support Features Language support Territory support Character set support Linguistic sorting Message support Date and time formats Numeric formats Monetary formats

2-4 Copyright © 2004, Oracle. All rights reserved. Encoding Schemes Oracle Database supports different classes of character encoding schemes: Single-byte character sets –7-bit –8-bit Fixed-width multibyte character sets Varying-width multibyte character sets Universal character sets, such as Unicode

2-5 Copyright © 2004, Oracle. All rights reserved.

2-6 Copyright © 2004, Oracle. All rights reserved.

2-7 Copyright © 2004, Oracle. All rights reserved. Database Character Sets and National Character Sets Can store Unicode using either AL16UTF16 or UTF8 Can store varying-width character sets Store data columns of type NCHAR, NVARCHAR2, NCLOB Store data columns of type CHAR, VARCHAR2, CLOB, LONG Can be exchangedCannot be changed without re-creation, few exceptions Defined at creation time National Character SetsDatabase Character Sets

2-8 Copyright © 2004, Oracle. All rights reserved. Database Character Sets and National Character Sets

2-9 Copyright © 2004, Oracle. All rights reserved. Datetimes with Timezones TIMESTAMP ' :26: :00' Valid value in V$TIMEZONE_NAMESTIMEZONE_REGION 00 to 59TIMEZONE_MINUTE -12 to 14TIMEZONE_HOUR 00 to 59.9 (N) -- N indicates precisionSECOND 00 to 59MINUTE 00 to 23HOUR 01 to 31DAY 01 to 12MONTH to 9999 (excluding 0)YEAR Valid ValuesDatetime Field

2-10 Copyright © 2004, Oracle. All rights reserved. Configuring the Database Local Timezone At the session level: Using an environment variable: At the database level: ALTER SESSION SET time_zone = 'Europe/London'; ALTER SESSION SET time_zone = LOCAL; $ export ORA_SDTZ = 'DB_TZ' CREATE DATABASE... SET TIME_ZONE='UTC'... ALTER DATABASE SET TIME_ZONE='-01:00';

2-11 Copyright © 2004, Oracle. All rights reserved. Configuring Datetime Formats NLS_TIMESTAMP_FORMAT NLS_TIMESTAMP_TZ_FORMAT Timezone Daylight savings timeTZD Timezone region nameTZR Timezone minutesTZM Timezone hourTZH Fractional secondsFF DefinitionFormat Element ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH:MI:SS.FF TZR TZD';

2-12 Copyright © 2004, Oracle. All rights reserved. Using Timezones :30: : :30:00.00 America/New_York :30: :00 CREATE TABLE orders (... orderdate2 TIMESTAMP(3) WITH TIME ZONE...); INSERT INTO orders VALUES (..., '28-OCT-04 11:24: PM America/New_York',...);

2-13 Copyright © 2004, Oracle. All rights reserved. SELECT sysdate FROM dual; Initialization parameter Environment variable ALTER SESSION command Specifying Language-Dependent Behavior SQL function

2-14 Copyright © 2004, Oracle. All rights reserved. Specifying Language-Dependent Behavior for the Server NLS_LANGUAGE specifies: –The language for database messages –Day and month names –Symbols for A.D., B.C., a.m., p.m. –The default sorting mechanism –Affirmative and negative response strings NLS_TERRITORY specifies: –Day and week numbering –Credit and debit symbols –Default date format, decimal character, group separator, list separator and the default ISO, dual and local currency symbols

2-15 Copyright © 2004, Oracle. All rights reserved. Language and Territory Dependent Parameters Parameter NLS_LANGUAGE NLS_DATE_LANGUAGE NLS_SORT Default Values AMERICAN BINARY AMERICA $ AMERICA DD-MON-RR., DD-MON-RRHH.MI.SSXFF AM DD-MON-RRHH.MI.SSXFF AM TZR NLS_TERRITORY NLS_CURRENCY NLS_DUAL_CURRENCY NLS_ISO_CURRENCY NLS_DATE_FORMAT NLS_NUMERIC_CHARACTERS NLS_TIMESTAMP_FORMAT NLS_TIMESTAMP_TZ_FORMAT

2-16 Copyright © 2004, Oracle. All rights reserved.

2-17 Copyright © 2004, Oracle. All rights reserved. Other NLS Server Parameters ParameterDefault Value NLS_CALENDAR Gregorian NLS_COMPBINARY NLS_LENGTH_SEMANTICSBYTE NLS_NCHAR_CONV_EXCPFALSE

2-18 Copyright © 2004, Oracle. All rights reserved. Specifying Language-Dependent Behavior for the Session Specify the locale behavior with the NLS_LANG environment variable: –Language –Territory –Character set Set other NLS environment variables to: –Override database initialization parameter settings for all sessions –Customize the locale behavior –Change the default location of the NLS library files NLS_LANG=FRENCH_CANADA.WE8ISO8859P1

2-19 Copyright © 2004, Oracle. All rights reserved.

2-20 Copyright © 2004, Oracle. All rights reserved. ALTER SESSION SET NLS_DATE_FORMAT='DD.MM.YYYY'; DBMS_SESSION.SET_NLS('NLS_DATE_FORMAT', '''DD.MM.YYYY''') ; Specifying Language-Dependent Behavior for the Session

2-21 Copyright © 2004, Oracle. All rights reserved. Locale Variants Belgium Bonjourguten Morgen Goede ochtend

2-22 Copyright © 2004, Oracle. All rights reserved. SELECT TO_CHAR(hire_date,'DD.Mon.YYYY', 'NLS_DATE_LANGUAGE=FRENCH') FROM employees WHERE hire_date > '01-JAN-2000'; SELECT last_name, first_name, TO_CHAR(salary,'99G999D99', 'NLS_NUMERIC_CHARACTERS='',.''') FROM employees; Using NLS Parameters in SQL Functions

2-23 Copyright © 2004, Oracle. All rights reserved.

2-24 Copyright © 2004, Oracle. All rights reserved. Using NLS Parameters in SQL Functions Function TO_DATE NLS Parameter NLS_DATE_LANGUAGE NLS_CALENDAR NLS_DATE_LANGUAGE NLS_NUMERIC_CHARACTERS NLS_CURRENCY NLS_[ISO|DUAL]_CURRENCY NLS_CALENDAR TO_CHAR, TO_NCHAR TO_NUMBERNLS_NUMERIC_CHARACTERS NLS_CURRENCY NLS_[ISO|DUAL]_CURRENCY NLS_UPPER, NLS_LOWER, NLS_INITCAP, NLSSORT NLS_SORT

2-25 Copyright © 2004, Oracle. All rights reserved. Linguistic Sorting Sort order can be affected by: Case sensitivity Diacritics or accent characters Combination characters that are treated as a single character Phonetics or character appearance Cultural preferences

2-26 Copyright © 2004, Oracle. All rights reserved. Linguistic Sorting Three types of sorting: Binary sorting: –Sorted according to the binary values of the encoded characters Monolingual linguistic sorting: –A two pass sort based on a character’s assigned major and minor values Multilingual linguistic sorting –Based on the ISO standard (ISO 14651), and the Unicode 3.2 Standard for multilingual collation –Ordered by the number of strokes, PinYin, or radicals for Chinese characters

2-27 Copyright © 2004, Oracle. All rights reserved. Using Linguistic Sorting You can specify the type of sort used for character data with the: NLS_SORT parameter –Default value is derived from the NLS_LANG environment variable, if set –Can be specified for the session, client, or server NLSSORT function –Defines the sorting method at the query level

2-28 Copyright © 2004, Oracle. All rights reserved.

2-29 Copyright © 2004, Oracle. All rights reserved. Sorts That Are Not Case or Accent Sensitive SELECT cust_last_name FROM oe.customers WHERE cust_last_name = 'de Funes'; SELECT cust_last_name FROM oe.customers WHERE cust_last_name = NLS_UPPER('de Funes'); ALTER SESSION SET NLS_COMP=ANSI; ALTER SESSION SET NLS_SORT=GENERIC_BASELETTER; SELECT cust_last_name FROM oe.customers WHERE cust_last_name = 'De Funes';

2-30 Copyright © 2004, Oracle. All rights reserved. Linguistic Comparisons Use the NLS_COMP parameter to: –Perform linguistic comparisons instead of binary comparisons –Avoid cumbersome statements involving the NLSSORT function NLS_COMP can be set to: – BINARY – ANSI SELECT word FROM list WHERE word > 'gf';

2-31 Copyright © 2004, Oracle. All rights reserved. Linguistic Index Support Create an index on linguistically sorted values Rapidly query data without having to specify ORDER BY clause and NLSSORT : Set the NLS_SORT parameter to match the linguistic definition you want to use for the linguistic sort when creating the index CREATE INDEX list_word ON list (NLSSORT(word, 'NLS_SORT=French_M')); SELECT word FROM list;

2-32 Copyright © 2004, Oracle. All rights reserved. Customizing Linguistic Sorting You can customize linguistic sorting for: Ignorable characters Contracting or expanding characters Special combination letters or special letters Expanding characters or special letters Special uppercase and lowercase letters Context-sensitive characters Reverse secondary sorting Canonical equivalence

2-33 Copyright © 2004, Oracle. All rights reserved. Oracle Locale Builder

2-34 Copyright © 2004, Oracle. All rights reserved. Character Set Scanner Utilities Character Set Scanner: –Scans the database to determine whether the character set can be changed –Provides reports that detail possible problems and fixes Language and Character Set File Scanner: –Determines the language and character set for unknown file text –Uses probabilities to identify the dominant language and character set

2-35 Copyright © 2004, Oracle. All rights reserved.

2-36 Copyright © 2004, Oracle. All rights reserved. CREATE DATABASE... CHARACTER SET WE8ISO8859P1 NATIONAL CHARACTER SET UTF8... % export NLS_LANG= American_America.US7ASCII Data Conversion Between Client and Server Character Sets C:/> set NLS_LANG= German_Germany.WE8DEC

2-37 Copyright © 2004, Oracle. All rights reserved. NLS Data Conversion with Oracle Utilities Multiple data conversions can take place when data is exported from one database and imported into another if the same character sets are not used. External tables use the NLS settings on the server for determining the data character set. SQL*Loader: –Conventional Path: Data is converted into the session character set specified by NLS_LANG. –Direct Path: Data is converted using client-side directives.

2-38 Copyright © 2004, Oracle. All rights reserved.

2-39 Copyright © 2004, Oracle. All rights reserved. NLS Data Conversion with Data Pump Data Pump Export always saves data in the same character set as the database from which the data originates. Data Pump Import converts the data to the character set of the target database, if needed. The Data Pump log file is written in the language specified by NLS_LANG for the session that started Data Pump.

2-40 Copyright © 2004, Oracle. All rights reserved. Obtaining Character Set Information SQL> SELECT parameter, value 2 FROM nls_database_parameters 3 WHERE parameter LIKE '%CHARACTERSET%'; PARAMETER VALUE NLS_CHARACTERSET WE8ISO8859P1 NLS_NCHAR_CHARACTERSET AL16UTF16 2 rows selected.

2-41 Copyright © 2004, Oracle. All rights reserved. Obtaining NLS Parameter Information SQL> ALTER SESSION SET NLS_ISO_CURRENCY=FRANCE; Session altered. SQL> SELECT * FROM nls_instance_parameters 2 WHERE parameter LIKE '%ISO%'; PARAMETER VALUE NLS_ISO_CURRENCY AMERICA SQL> SELECT * FROM nls_session_parameters 2 WHERE parameter LIKE '%ISO%'; PARAMETER VALUE NLS_ISO_CURRENCY FRANCE

2-42 Copyright © 2004, Oracle. All rights reserved. Obtaining NLS Settings Information V$NLS_VALID_VALUES : Contains the values for NLS_LANGUAGE, NLS_SORT, NLS_TERRITORY and CHARACTERSET that are valid on your system V$NLS_PARAMETERS : –Contains the current NLS session settings, including character sets –Used as the basis for NLS_SESSION_PARAMETERS

2-43 Copyright © 2004, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Customize language-dependent behavior for the database and individual sessions Specify different linguistic sorts for queries Retrieve data that matches a search string ignoring case or accent differences Obtain Globalization support configuration information

2-44 Copyright © 2004, Oracle. All rights reserved. Practice 2 Overview: Using Globalization Support Features This practice covers the following topics: Checking the database and national character set Identifying valid NLS values Setting NLS parameters

2-45 Copyright © 2004, Oracle. All rights reserved. Practice 2: Using Globalization Support Features

2-46 Copyright © 2004, Oracle. All rights reserved. Practice 2: Globalization Support