Download presentation
Presentation is loading. Please wait.
Published byMeagan Hunter Modified over 9 years ago
2
New SQL Capabilities in Oracle Database 10 g Geoff Lee, Principal Product Manager Peter Linsley, PMTS Oracle Corporation Session id: 40088
3
Agenda Overview New Features Demo Summary Q&A
4
Oracle8 Evolution of Oracle SQL Engine Oracle8iOracle9iOracle9i R2 SQL /XML Integration (XMLType, URIType, etc.) OLAP Datetime Types ANSI Joins CASE Expressions XML DB SQL/XML W3C Standards Data Mining Grid Web Services Regular Expressions Native Numbers BLAST Expression Filter Objects Extension Data Cartridges SQL/Java Integration interMedia Types Data and Processing complexity
5
Oracle SQL Engine Architecture Optimizer Query Engine Index Engine Type Manager Extensibility TextText Text Spatial Utilities Tools ImageImage Image TextSpatial Image Data Cartridges SpatIalSpatIal
6
Oracle8 Evolution of Oracle Objects Oracle8iOracle9iOracle9i R2 UDT/REF/ Collections/LOBs Object Tables Object Views Instead-Of Trigger Performance JavaVM/JDBC/JPub OO4O Type Inheritance Multi-Level Collections Type Evolution Long to LOB API Anytype/XMLType/ URIType/SQLJ Object Type Parallel Piplelined Table Function OCCI Type Synonym User-Defined Constructor Collection/LOB Enhancements
7
Agenda Overview New Features – Regular Expressions – Native Numbers – LOB Enhancements – Collection Enhancements Demo Summary Q&A
8
Introduction to Pattern Matching Pattern matching and manipulation – Match 'abc', match email address, etc LIKE often not expressive enough Non-native and client solutions have drawbacks
9
Introduction to Regular Expressions Origins in mathematics First computerized in UNIX – From ed, grep, perl, cgi, web, to everywhere Multitude of applications – Validation in HTML FORMS – Bioinformatics – Server configuration – Datamining
10
Oracle Regular Expressions Native support to the database – Interfaces in SQL and PL/SQL – Based on POSIX standard – Sync with GNU, PERL, Java, XQuery, etc. Patterns describing data become a property of the data Powerful string manipulation within the database
11
Enhanced Data Flow Validate and Format Filter and Format
12
Key Features POSIX Extended Regular Expressions Interfaces – REGEXP_LIKEdoes pattern match? – REGEXP_SUBSTRwhat does it match? – REGEXP_INSTRwhere does it match? – REGEXP_REPLACEreplace what matched. Match options Locale Support LOB Support
13
. match any character a? match 'a' zero or one time a* match 'a' zero or more times a+ match 'a' one or more times a|b match either 'a' or 'b' a{m,n} match 'a' between m and n times [abc] match either 'a' or 'b' or 'c' (abc) match group 'abc' \n match nth group [:cc:] match character class [.ce.] match collation element [=ec=] match equivalence class Metacharacters Operator Description
14
REGEXP_LIKE Determine whether pattern exists Find variations on the name 'Jon Stevens' – John or Jon – Steven or Stevens or Stephen or Stephens SELECT c1 FROM t1 WHERE REGEXP_LIKE(c1, ‘Joh?n Ste(ph|v)ens?’); Jon Stevens John Stephens John Stevens
15
REGEXP_SUBSTR Determine what text matched Extract matching variation SELECT REGEXP_SUBSTR( ‘I am the real Jon Stevens’, ‘Joh?n Ste(ph|v)ens?’) FROM dual; Jon Stevens
16
REGEXP_INSTR Find out where the match occurred Find the matching word SELECT REGEXP_INSTR( ‘I am the real Jon Stevens’, ‘Joh?n Ste(ph|v)ens?’) FROM dual; 15
17
REGEXP_REPLACE Replace matching text Supports back references in replacement text Fix alternative spellings SELECT REGEXP_REPLACE ( ‘I am the real John Stephens.’, ‘Joh?n Ste(ph|v)ens?’, ‘Jon Stevens’) FROM t1; I am the real Jon Stevens.
18
Using with DDL Filter allowable data with check constraint – ZIP code column is VARCHAR2(5) but can hold any 5 characters. Query subset and format with views – format phone number to (xxx) xxx-xxxx Create functional based index
19
Using with PL/SQL Very powerful string manipulation abilities src := REGEXP_REPLACE (src, ‘ ’); Can enhance on existing abilities – Support PERL shorthand – Extract nth subexpression Replace hundreds of lines of code – String manipulation functions can be simplified
20
Performance Considerations Pattern matching can be complex – Need to compile to state machine – Lex and parse – Examine all possible branches until match found Compiled once per statement – Can be faster than LIKE for complex scenarios – Usually faster than PL/SQL equivalent ZIP code checking 5 times faster Write fast performing expressions.
21
Agenda Overview New Features – Regular Expressions – Native Numbers – LOB Enhancements – Collection Enhancements Demo Summary Q&A
22
Native Floating-Point Data Types Two new numeric data types BINARY_FLOAT, BINARY_DOUBLE – IEEE 754 Standard for binary floating point arithmetic – Part of numerous other standards (e.g, Java, XML Schema) and hardware platforms – Prevalent in Business Intelligence, Life Sciences, Engineering/Scientific Computation, etc.
23
Native Floating-Point Data Types vs. Number Data Type More efficient than the NUMBER type – Hardware arithmetic/math are 5 – 10 times faster – Take up less space in memory/disk (5/9 vs. 1 – 22 Bytes each) – BINARY_DOUBLE has wider value range (e308 vs. e125) – No type convesion (use a byte-order neutral storage format)
24
Native Floating-Point Functions New type conversion functions – TO_BINARY_FLOAT, TO_BINARY_DOUBLE – TO_NUMBER SQL function support – Numberic functions (sin, cos, etc.) – Aggregate functions (sum, avg, stddev, etc.) – Analytic functions (sum, avg, stddev, etc.) Seamless support in SQL, PL/SQL, Java, XML Schema registration, ODP.NET and OCI/OCCI
25
Native Floating Point Constraints create table floating_point_table1 ( fltNnull binary_float constraint flt_null not null, dblNnull binary_double constraint dbl_null not null, fltUnq binary_float constraint flt_unq unique, dblUnq binary_double constraint dbl_unq unique, fltChk binary_float constraint flt_chk check ( fltChk is not NaN ), dblChk binary_double constraint dbl_chk check ( dblChk is not infinite), fltPrm binary_float constraint flt_prm primary key); * NaN (Not a Number) – e.g. 0/0, infinity/infinity
26
Native Floating Point Constraints create table floating_point_table2 ( dblPrm binary_double constraint dbl_prm primary key, fltFrn binary_float constraint flt_frn references floating_point_table1(fltPrm) on delete cascade);
27
Agenda Overview New Features – Regular Expressions – Native Numbers – LOB Enhancements – Collection Enhancements Demo Summary Q&A
28
LOB Enhancements LOBs are prevalent in storing unstructured data (text, AVI, genomic/proteomic sequences, etc.) Implicit charset conversion Between CLOB and NCLOB
29
LOB Performance Improvements 5x performance gain for accessing inline (< 4KB) LOBs Temporary LOBs uses reference counting to provide orders of magnitude performance gain – Reference on Read – Copy on Write
30
Ultra-Sized LOBs Terabyte (8 – 128 TB) sized Lobs – DB_BLOCK_SIZE (2 – 32 KB) x (4GB –1) – New DBMS_LOB.GET_STORAGE_LIMIT function – OCI, JDBC, and DBMS_LOB now supports LOBs greater than 4GB OCILobRead2(), OCIWriteAppend2(), and OCILobWrite2() functions Same APIs for JDBC and DBMS_LOB
31
Data Interface for Persistent LOBs Client DML (insert/update) can bind char buffers (up to 4GB) to LOB values without the locator – OCI, JDBC, and ODP.NET support – Up to 32KB with PL/SQL No server round-trip to get the locator before insert/update
32
Implicit Conversion Between CLOB and NCLOB CREATE TABLE my_table (nclob_col NCLOB); DECLARE clob_var CLOB; nclob_var NCLOB; BEGIN clob_var := 'clob data'; -- initialize the CLOB value; -- Bind a CLOB into an NCLOB column INSERT INTO my_table VALUES (clob_var); SELECT nclob_col INTO clob_var FROM my_table; -- Define an NCLOB column as a CLOB var END; /
33
Datetime Enhancements The best implementation of ANSI SQL timestamp with (local) time zone – Expanded region time zone names support Default: $ORACLE_HOME/oracore/zoneinfo /timezone.dat (146 KB) Larger set: ORACLE_HOME/oracore/zoneinfo /timezlrg.dat (380 KB) – ORA_TZFILE specifies the file used by the database – Loaded into SGA during instance startup – Valid region names are listed in v$timezone_names
34
Agenda Overview New Features – Regular Expressions – Native Numbers – LOB Enhancements – Collection Enhancements Demo Summary Q&A
35
Collection Types Enhancements User-defined types, collection types, and Ref type simplify complex- structured data modeling Collections types are used for mapping containment relationships in real world applications – For example, a shopping cart contains a number of items
36
VARRAY Enhancements Type evolution of VARRAYs CREATE TYPE email_list_typ AS OBJECT ( section_no NUMBER, emails email_list_arr); / CREATE TYPE email_varray_typ AS VARRAY(5) OF email_list_typ; / ALTER TYPE email_varray_typ MODIFY LIMIT 100 CASCADE; Support VARRAY columns in temporary tables – Provides application development flexibility
37
Nested Table Enhancements Use a different tablespace for a Nested Table’s storage table – Tables with Nested Table columns can distribute I/O load among tablespaces CREATE TABLE purchase_orders ( order_items_column order_items_typ ) NESTED TABLE order_items_column STORE AS order_items_column_nt (TABLESPACE users);
38
ANSI SQL Multiset Operations for Nested Tables A Nested Table stores unordered elements – A set contains only unique elements – A multiset can contain duplicate elements Full range of Multiset operations on Nested Tables
39
Multiset Operations for Nested Tables Cardinality, Collect, Multiset Except, Multiset Intersection, Multiset Union, Powermultiset, Powermultiset_by_Cardinality, and Set operations – Powerful tools to find frequent item sets (market basket analysis)
40
Multiset Operation Example create type categories as table of int; / create table carts (c1 int, c2 categories) nested table c2 store as tb1_c2; insert into carts values(1, categories(1,2,3,4)); insert into carts values(2, categories(2,4,6)); select t1.c2 multiset intersect t2.c2 from carts t1, carts t2 where t1.c1=1 and t2.c1=2; categories(2,4) <- frequent set
41
Comparisons of Nested Tables Equal and Not Equal, In, Submultiset, Member Of, Empty, and Is [Not] A Set SELECT * FROM customer c WHERE item_typ(2) MEMBER OF c.freq_set;
42
Agenda Overview New Features Demo Summary Q&A
43
D E M O N S T R A T I O N SQL for Data Grids
44
Aggregated Information Web Service JDBC /JXQI SOAP XQuery Engine Aggregated Information EIS Oracle SQL Engine HTTP/SOAP J2EE TM CA Streams Heterogeneous Services
45
XQuery FLWOR Expressions A FLWOR (flower) expression binds some expressions, applies a predicate, and constructs a new result. FOR var IN expr LET var := expr WHERE expr RETURN expr FOR and LET clauses generate a list of tuples of bound expressions WHERE clause applies a predicate, eliminating some of the tuples RETURN clause is executed for each surviving tuple, generating a list of outputs ORDER BY expr
46
Agenda Overview New Features Demo Summary Q&A
47
Summary Oracle Database 10 g SQL engine – Data Grid information aggregation from diverse and distributed data sources – Seamless integration with Java, XML, and essential data processing capabilities – A comprehensive set of high-performance and standards-based (SQL-2003, W3C, J2SE, POSIX, etc.) features – Simplified application development, deployment, and management – RAS, manageability, and security
48
Next Steps…. Relevant web sites to visit for more information – http://otn.oracle.com/products/database/ application_development/ – OTN SQL/PL-SQL discussion forum – http://otn.oracle.com/tech/xml/xmldb/htdocs /xquery.html
49
Reminder – please complete the OracleWorld online session survey Thank you.
50
A Q & Q U E S T I O N S A N S W E R S
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.