View
169
Download
4
Category
Preview:
DESCRIPTION
AIOUG Techday August 23rd Hyderabad - 12c Theme
Citation preview
The following is intended to outline our general product
direction. It is intended for information purposes only, and
may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality,
and should not be relied upon in making purchasing
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
and should not be relied upon in making purchasing
decisions. The development, release, and timing of any
features or functionality described for Oracle's products
remains at the sole discretion of Oracle.
Oracle Database 12cApplication DevelopmentOracle Database 12cApplication Development
Saurabh K. Gupta
Oracle Database Product Management
Big DataBig Data
ConsolidationConsolidation
Data Data OptimizationOptimization
Application DevelopmentApplication Development
Data WarehousingData Warehousing
Plug into the Cloud
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Security & ComplianceSecurity & Compliance
High AvailabilityHigh Availability
InIn--MemoryMemory
Performance & ScalabilityPerformance & Scalability
Data WarehousingData Warehousing
Development in Oracle Database 12c
A rich and powerful development environment
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Agenda
• Temporal Databases
• SQL New features
• PL/SQL New features
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
• PL/SQL New features
• Partitioning
• SQL Developer
Multitenant New Features in 12.1.0.2
• Subset by tablespace
• Metadata-only clone
• Remote clone (including snapshots)
• New SQL clause to aggregate data across PDBs
select ENAME from containers(scott.EMP)where CON_ID in (45, 49);
Cloning
SQL
Cross PDB Queries
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
• New “standbys” clause
• (all | none)
• Nologging clause at PDB level
• Flashback data archive, transaction query & backout
• Temporal SQL Support
• Compatible with DB In-Memory
• Maintains state of PDBs between CDB restarts
7
Cloning Cross PDB Queries
Standby & Logging
PRIMARY STANDBY
AdditionalFeatures
Temporal Validity Temporal Validity
Flash Back Data ArchiveFlash Back Data Archive
Oracle Database 12c and Temporal Data• Managing the time dimension
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Flashback QueryFlashback Query
Temporal Applications
• Developing applications that understand history is complicated
• Querying and reporting history data is hard, as schemas evolve
Modeling time is hard
Employees
History Kept
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
schemas evolve
• The result is history is only tracked for a few key tables
– Often raw fact data is tracked but context is not
– e.g. Sales history is tracked, but not quota rules, or territories
Departments
No History
Oracle Database 12c Temporal Support
Transaction Time Temporal
(Flashback Data Archive)
� Tracks transactional changes to a
table over its lifetime
Valid Time Temporal
� Enables user to model & query data
for “real world validity”
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
table over its lifetime
� Typically used for compliance and
auditing
� Enables the users to see the data
as it was at a point in time in the
past
� Typically used for insurance policies,
financial markets, trade data & future
changes
� Users can model concepts such as
the “Life time of an insurance policy”
Valid Time Temporal
• VALID TIME rows are stored in the base table itself
• By default, queries see all rows in the table
Querying Data Validity
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Changes are written to
timestamp columns on base
table
Valid Time Data read from base table
(filtered using SQL)
Valid Time TemporalExample
CREATE TABLE customers(
custid NUMBER,
custname VARCHAR2(30),
custaddr1 VARCHAR2(50),
custaddr2 VARCHAR2(50),
custcity VARCHAR2(50),
CREATE TABLE customers(
custid NUMBER,
custname VARCHAR2(30),
custaddr1 VARCHAR2(50),
custaddr2 VARCHAR2(50),
custcity VARCHAR2(50),
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
custcity VARCHAR2(50),
custstate VARCHAR2(2),
custzip VARCHAR2(20),
start_time TIMESTAMP,
end_time TIMESTAMP,
PERIOD FOR cust_valid_time (start_time, end_time));
custcity VARCHAR2(50),
custstate VARCHAR2(2),
custzip VARCHAR2(20),
start_time TIMESTAMP,
end_time TIMESTAMP,
PERIOD FOR cust_valid_time (start_time, end_time));
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time
1 Acme Inc 123 Any
Street
Suite 17 Anytown CA 99999 01-JAN-14
Valid Time TemporalExample
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
INSERT INTO CUSTOMERS VALUES (1,'Acme Inc.','123 Any Street','Suite 17','Anytown','AS','99999', TO_TIMESTAMP('01-JAN-14’), NULL);
INSERT INTO CUSTOMERS VALUES (1,'Acme Inc.','123 Any Street','Suite 17','Anytown','AS','99999', TO_TIMESTAMP('01-JAN-14’), NULL);
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time
1 Acme Inc 123 Any
Street
Suite 17 Anytown CA 99999 01-JAN-14 31-AUG-14
Valid Time TemporalExample
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
UPDATE customers
SET end_time = TO_TIMESTAMP('31-AUG-14’)
WHERE custid = 1 ;
UPDATE customers
SET end_time = TO_TIMESTAMP('31-AUG-14’)
WHERE custid = 1 ;
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time
1 Acme Inc 123 Any
Street
Suite 17 Anytown CA 99999 01-JAN-14 31-AUG-14
1 Acme Inc 456
Another
Street
Anytown CA 99998 01-SEP-14
Valid Time TemporalExample
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
INSERT INTO CUSTOMERS VALUES (1, 'Acme Inc.',
’456 Another Street', NULL, 'Anytown', 'AS', ‘99998', TO_TIMESTAMP('01-SEP-14’), NULL ) ;
INSERT INTO CUSTOMERS VALUES (1, 'Acme Inc.',
’456 Another Street', NULL, 'Anytown', 'AS', ‘99998', TO_TIMESTAMP('01-SEP-14’), NULL ) ;
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time
1 Acme Inc 123 Any
Street
Suite 17 Anytown CA 99999 01-JAN-14 31-AUG-14
1 Acme Inc 456
Another
Street
Anytown CA 99998 01-SEP-14
Valid Time TemporalExample
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SELECT custaddr1, custaddr2, custcity, custstate, custzip
FROM customers WHERE custid=1;
SELECT custaddr1, custaddr2, custcity, custstate, custzip
FROM customers WHERE custid=1;
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time
1 Acme Inc 123 Any
Street
Suite 17 Anytown CA 99999 01-JAN-14 31-AUG-14
1 Acme Inc 456
Another
Street
Anytown CA 99998 01-SEP-14
Valid Time TemporalExample
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
EXEC DBMS_FLASHBACK_ARCHIVE.ENABLE_AT_VALID_TIME('CURRENT');
SELECT custid, start_time, end_time
FROM customers WHERE custid=1;
EXEC DBMS_FLASHBACK_ARCHIVE.ENABLE_AT_VALID_TIME('CURRENT');
SELECT custid, start_time, end_time
FROM customers WHERE custid=1;
custid custname custaddr1 custaddr2 custcity custstate custzip start_time end_time
1 Acme Inc 123 Any
Street
Suite 17 Anytown CA 99999 01-JAN-14 31-AUG-14
1 Acme Inc 456
Another
Street
Anytown CA 99998 01-SEP-14
Valid Time TemporalExample
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SELECT custid, start_time, end_time
FROM customers
AS OF PERIOD FOR cust_valid_time TO_TIMESTAMP('03-SEP-14');
SELECT custid, start_time, end_time
FROM customers
AS OF PERIOD FOR cust_valid_time TO_TIMESTAMP('03-SEP-14');
Temporal with Oracle Database 12c Minimizing custom Code
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
� Transaction Time Temporal
(flashback data archive)
maintains history
� Valid Time Temporal maintains
business validity
Pattern MatchingPattern Matching
PL/SQL in “With” ClausePL/SQL in “With” Clause
Identity Based ColumnsIdentity Based Columns
32k 32k VarcharVarchar
A more powerful expressive language
Oracle Database 12c : The Evolution of SQL
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Fetch First Fetch First
Invisible ColumnsInvisible Columns
Improved Left Outer Join SyntaxImproved Left Outer Join Syntax
32k 32k VarcharVarchar
Pattern MatchingSimplified Analysis of Big Data
Select * from Employees MATCH_RECOGNIZE (…PATTERN(X+ Z{2})…)
• Scalable discovery of business event sequences
– Clickstream logs: sessionization, search behaviour
– Financial transactions: fraud detection, double bottom (“W”) stock analysis
– Telco: dropped calls
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
) – Telco: dropped calls
– Medical sensors: automated medical observations and detections
Patterns are defined
using regular
expressions
Asc
en
din
g O
rde
r
Find double bottom (W) patterns and report:
• Beginning and ending date of the pattern
SQL Pattern MatchingExample: Find Double Bottom (W)
days
Stock price
XX
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
• Average Price Increase in the second ascent
• Modify the search to find only patterns that lasted less than a week
PATTERN (X+ Y+ W+ Z+)DEFINE X AS (price < PREV(price))
Find double bottom (W) patterns and report:
• Beginning and ending date of the pattern
SQL Pattern MatchingExample: Find Double Bottom (W)
days
Stock price
XX YY
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
• Average Price Increase in the second ascent
• Modify the search to find only patterns that lasted less than a week
PATTERN (X+ Y+ W+ Z+)DEFINE X AS (price < PREV(price))
Y AS (price > PREV(price))
Find double bottom (W) patterns and report:
• Beginning and ending date of the pattern
SQL Pattern MatchingExample: Find Double Bottom (W)
days
Stock price
SELECT first_x, last_zSELECT first_x, last_z
XX YY WW ZZ
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
• Average Price Increase in the second ascent
• Modify the search to find only patterns that lasted less than a week
SELECT first_x, last_zFROM ticker MATCH_RECOGNIZE (
PARTITION BY name ORDER BY time MEASURES FIRST(x.time) AS first_x
LAST(z.time) AS last_zONE ROW PER MATCHPATTERN (X+ Y+ W+ Z+)DEFINE X AS (price < PREV(price))
Y AS (price > PREV(price))W AS (price < PREV(price))Z AS (price > PREV(price))
SQL Pattern Matching
1 9 13 19 days
Stock price
SELECT first_x, last_zSELECT first_x, last_z
First_x Last_z
1 9
13 19Example: Find Double Bottom (W)
Find double bottom (W) patterns and report:
• Beginning and ending date of the pattern
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SELECT first_x, last_zFROM ticker MATCH_RECOGNIZE (
PARTITION BY name ORDER BY time MEASURES FIRST(x.time) AS first_x,
LAST(z.time) AS last_zONE ROW PER MATCHPATTERN (X+ Y+ W+ Z+)DEFINE X AS (price < PREV(price)),
Y AS (price > PREV(price)),W AS (price < PREV(price)),Z AS (price > PREV(price)))
• Average Price Increase in the second ascent
• Modify the search to find only patterns that lasted less than a week
if (lineNext == null) {next = "";
} else {next = lineNext.getQuantity();
}
if (!q.isEmpty() && (prev.isEmpty() || (eq(q, prev) && gt(q, next)))) {state = "S";return state;
}
if (gt(q, prev) && gt(q, next)) {state = "T";return state;
}
if (lt(q, prev) && lt(q, next)) {state = "B";return state;
}
if (!q.isEmpty() && (next.isEmpty() || (gt(q, prev) && eq(q, next)))) {state = "E";return state;
}
if (q.isEmpty() || eq(q, prev)) {state = "F";return state;
}
return state;}
private boolean eq(String a, String b) {if (a.isEmpty() || b.isEmpty()) {
return false;}return a.equals(b);
}
private boolean gt(String a, String b) {
Pattern MatchingFinding Double Bottom (W)
SELECT first_x, last_zFROM ticker MATCH_RECOGNIZE (
PARTITION BY name ORDER BY time MEASURES FIRST(x.time) AS first_x,
LAST(z.time) AS last_zONE ROW PER MATCHPATTERN (X+ Y+ W+ Z+)DEFINE X AS (price < PREV(price)),
Y AS (price > PREV(price)),
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
private boolean gt(String a, String b) {if (a.isEmpty() || b.isEmpty()) {
return false;}return Double.parseDouble(a) > Double.parseDouble(b);
}
private boolean lt(String a, String b) {if (a.isEmpty() || b.isEmpty()) {
return false;}return Double.parseDouble(a) < Double.parseDouble(b);
}
public String getState() {return this.state;
}}BagFactory bagFactory = BagFactory.getInstance();
@Overridepublic Tuple exec(Tuple input) throws IOException {
long c = 0;String line = "";String pbkey = "";V0Line nextLine;V0Line thisLine;V0Line processLine;V0Line evalLine = null;V0Line prevLine;boolean noMoreValues = false;String matchList = "";ArrayList<V0Line> lineFifo = new ArrayList<V0Line>();boolean finished = false;
DataBag output = bagFactory.newDefaultBag();
if (input == null) {return null;
}if (input.size() == 0) {
return null;
Y AS (price > PREV(price)),W AS (price < PREV(price)),Z AS (price > PREV(price) AND
z.time - FIRST(x.time) <= 7 ))
250+ Lines of Java and PIG 12 Lines of SQL
20x less code, 5x faster
New SQL Functionality
• PL/SQL in SQL via the “with” clause
– Useful for read only databases
– Potentially faster for some operations
• IDENTITY based columns
– Auto incrementing columns
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
– Supports ANSI standard
• Increased size for VARCHAR2
– Increase from 4000 to 32K
• New Row limiting clause
PL/SQL in SQLExample
WITH
FUNCTION get_domain(url VARCHAR2) RETURN VARCHAR2 IS
pos BINARY_INTEGER;
len BINARY_INTEGER;
BEGIN
WITH
FUNCTION get_domain(url VARCHAR2) RETURN VARCHAR2 IS
pos BINARY_INTEGER;
len BINARY_INTEGER;
BEGIN
PL/SQL Function embedded in “with” clause
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
pos := INSTR(url, 'www.');
len := INSTR(SUBSTR(url, pos + 4), '.') - 1;
RETURN SUBSTR(url, pos + 4, len);
END;
SELECT DISTINCT get_domain(catalog_url)
FROM orders;
pos := INSTR(url, 'www.');
len := INSTR(SUBSTR(url, pos + 4), '.') - 1;
RETURN SUBSTR(url, pos + 4, len);
END;
SELECT DISTINCT get_domain(catalog_url)
FROM orders;
PL/SQL from SQL
sql> create table t ( x varchar2(5) );Table created.
sql> insert into t values ( 'a' );sql> insert into t values ( '1' );
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
sql> insert into t values ( '1' );sql> insert into t values ( null );
PL/SQL from SQL
sql> create or replace2 function is_number_ool(x in varchar2)3 return varchar24 is5 Plsql_Num_Error exception;6 pragma exception_init(Plsql_Num_Error, -06502);7 begin8 if (To_Number(x) is NOT null) then9 return 'Y';
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
9 return 'Y';10 else11 return '';12 end if;13 exception14 when Plsql_Num_Error then15 return 'N';16 end Is_Number_ool;17 /Function created.
PL/SQL from SQL
sql> select rownum, x,2 is_number_ool(x) is_num3 from t;
ROWNUM X IS_NUM
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
ROWNUM X IS_NUM---------- ----- ----------
1 a N2 1 Y3
PL/SQL from SQL
sql> with2 function Is_Number3 (x in varchar2) return varchar2 is4 Plsql_Num_Error exception;5 pragma exception_init(Plsql_Num_Error, -06502);6 begin7 if (To_Number(x) is NOT null) then8 return 'Y';9 else
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
9 else10 return '';11 end if;12 exception13 when Plsql_Num_Error then14 return 'N';15 end Is_Number;16 select rownum, x, is_number(x) is_num from t17 /
PL/SQL from SQL
select is_number_ool( to_char(object_id) ),
is_number_ool( owner )
from stage
call count cpu elapsed rows
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
call count cpu elapsed rows
------- ------ -------- ---------- ---------
Parse 1 0.00 0.00 0
Execute 1 0.00 0.00 0
Fetch 875 0.93 1.34 87310
------- ------ -------- ---------- ---------
total 877 0.93 1.34 87310
PL/SQL from SQL
with
function Is_Number ... end Is_Number;
select is_number( to_char(object_id) ) …,
call count cpu elapsed rows
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
call count cpu elapsed rows
------- ------ -------- ---------- ---------
Parse 1 0.00 0.00 0
Execute 1 0.00 0.00 0
Fetch 875 0.29 0.55 87310
------- ------ -------- ---------- ---------
total 877 0.29 0.55 87310
Improved Defaults
� Default to a sequence
� Default when null inserted
� Identity Columns
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
� Identity Columns
� Metadata-only Defaults for NULL columns
Improved Defaults - sequences
sql> create sequence s;Sequence created.
sql> create table t2 ( x int default s.nextval primary key,
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
2 ( x int default s.nextval primary key,3 y varchar2(30)4 )5 /
Table created.
Improved Defaults - sequences
sql> insert into t(y) values ('hello world');1 row created.
sql> select * from t;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
sql> select * from t;
X Y---------- ------------------------------
1 hello world
Improved Defaults – when null
sql> create table t2 ( x number default s.nextval primary key,3 y number,4 z number default on null 425 );
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
5 );
Table created.
Improved Defaults – when null
sql> insert into t (y, z) values ( 55, NULL );sql> insert into t (y,z) values ( 100, 200 );sql> insert into t (x,y,z) values (-1,-2,-3);
sql> select * from t;
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
sql> select * from t;
X Y Z---------- ---------- ----------
2 55 423 100 200-1 -2 -3
IDENTITYExample
CREATE TABLE t1x NUMBER GENERATED AS IDENTITY,y NUMBER
);
CREATE TABLE t1x NUMBER GENERATED AS IDENTITY,y NUMBER
);
Create a table where the id column is always populated by Oracle
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
CREATE TABLE t2(x NUMBER GENERATED BY DEFAULT AS IDENTITY
(START WITH 100 INCREMENT BY 10),y NUMBER
);
CREATE TABLE t2(x NUMBER GENERATED BY DEFAULT AS IDENTITY
(START WITH 100 INCREMENT BY 10),y NUMBER
);
Create a table where the id column is populated by Oracle when not provided
Identity columns
sql> insert into t1 (x,y) values (1,100);insert into t1 (x,y) values (1,100)
*ERROR at line 1:ORA-32795: cannot insert into a generated always identity column
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
sql> insert into t1 (y) values (200);1 row created.
sql> select * from t1;X Y
---------- ----------1 200
Identity columns
sql> insert into t2 (x,y) values (1,100);1 row created.
sql> insert into t2 (y) values (200);1 row created.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
sql> select * from t2;
X Y---------- ----------
1 100100 200
Improved Defaults – metadata only defaults
sqlORA12CR1> set timing onsqlORA12CR1> alter table t add (data char(2000) default 'x');Table altered.
Elapsed: 00:00:00.07
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
sqlORA11GR2> set timing onsqlORA11GR2> alter table t add (data char(2000) default 'x');Table altered.
Elapsed: 00:00:28.59
32K VARCHAR2/NVARCHAR2 Example
ALTER SYSTEM set MAX_STRING_SIZE = EXTENDED scope = SPFILEALTER SYSTEM set MAX_STRING_SIZE = EXTENDED scope = SPFILE
Enable 32k support in the Oracle Database 12c
Create table with 32k varchar2
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
CREATE TABLE Applicants(id NUMBER GENERATED AS IDENTITY,first_name varchar2(30),last_name varchar2(30),application date,CV varchar2(32767)
);
CREATE TABLE Applicants(id NUMBER GENERATED AS IDENTITY,first_name varchar2(30),last_name varchar2(30),application date,CV varchar2(32767)
);
Row LimitExample
SELECT employee_id, last_name
FROM employees
ORDER BY employee_id
FETCH FIRST 5 ROWS ONLY ;
SELECT employee_id, last_name
FROM employees
ORDER BY employee_id
FETCH FIRST 5 ROWS ONLY ;
Select only the first 5 rows
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
SELECT employee_id, last_name, salary
FROM employees
ORDER BY salary
FETCH FIRST 5 PERCENT ROWS WITH TIES ;
SELECT employee_id, last_name, salary
FROM employees
ORDER BY salary
FETCH FIRST 5 PERCENT ROWS WITH TIES ;
Select the first 5% of rows and those whose salary “ties” with the lowest of the 5%
Session SequencesExample
� Persistent only within a session
� Specific for use with GTTs
� Global sequences created by the primary database can now be
accessed from standby databases.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
sql> create sequence seqsess session;
sql> create sequence seqglob global;
sql> create sequence seqsess session;
sql> create sequence seqglob global;
accessed from standby databases.
Invisible ColumnsExample
sql> create table t3 (x NUMBER, y NUMBER invisible);sql> create table t3 (x NUMBER, y NUMBER invisible);
� User specified hidden columns
� The DESCRIBE shows invisible column metadata only when
SET COLINVISIBLE is set
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
sql> insert into t3 values (1);
sql> insert into t3 (x,y) values (2,5);
sql> insert into t3 values (1);
sql> insert into t3 (x,y) values (2,5);
sql> select * from t3;
X
----------
1
2
sql> select * from t3;
X
----------
1
2
sql> select x,y from t3;
X Y
------- ----------
1
2 5
sql> select x,y from t3;
X Y
------- ----------
1
2 5
Fine-Grained access controls for PL/SQL program units
� Specify the “white list” of PL/SQL program units which can access a
packaged subprograms or a PL/SQL unit
� Use ACCESSIBLE BY clause to specify the authorized subprograms
ACCESSIBLE BY (accessor_list)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
� Can appear in CREATE PACKAGE, CREATE PROCEDURE, CREATE
FUNCTION and CREATE TYPE statements
� Can be used with AUTHID clause in any order
ACCESSIBLE BY (accessor_list)
The ACCESSIBLE BY clauseCREATE OR REPLACE PROCEDURE p_demo_accACCESSIBLE BY (PROCEDURE proc, FUNCTION fun)ISBEGINdbms_output.put_line('Demonstrate White List Access');END;
PROC and FUN
constitute
the “White List”
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Exec P_DEMO_ACC();BEGIN p_demo_acc(); END;
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00904: insufficient privilege to access object P_DEMO_ACC
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Exec PROC();Demonstrate White List Access
PL/SQL procedure successfully completed.
Anonymously Invoked Invoked from a “White list” unit
Binding PL/SQL Only data types
● Prior to 12c, PL/SQL – only data types could not be bound from client programs or using native dynamic SQL
● In Oracle database 12c, a PL/SQL anonymous block, a SQL CALL statement or SQL query can invoke a PL/SQL subprogram which has parameters
BOOLEAN
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
● BOOLEAN
● Collection or records declared in a package specification
● PL/SQL – only data types can cross PL/SQL to SQL interface
Binding PL/SQL Only data types
EXECUTE IMMEDIATE l_stmt USING var_x;*
ERROR at line 6:ORA-06550: line 6, column 33:PLS-00457: expressions have to be of SQL typesORA-06550: line 6, column 2:PL/SQL: Statement ignored
CREATE OR REPLACE PROCEDURE proc (p_x BOOLEAN)IS BEGINIF p_x THEN
dbms_output.put_line('TRUE');ELSE
dbms_output.put_line('FALSE');END IF;END;
Pre Oracle 12c
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
TRUE
PL/SQL procedure successfully completed.
END;/
SET SERVEROUTPUT ONDECLAREl_stmt VARCHAR2(1000);var_x BOOLEAN := TRUE;BEGINl_stmt := 'begin proc(:1); end;';EXECUTE IMMEDIATE l_stmt USING var_x;end;/
Oracle Database 12c
Miscellaneous PL/SQL Enhancements
● Compilation parameter PLSQL_DEBUG deprecated
● An invoker’s rights function can be result cached in Oracle 12c.
● Grant roles to PL/SQL packages and standalone subprograms.
● An Object of Type LIBRARY Can Be Defined Using an Object of Type DIRECTORY
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
DIRECTORY
● New PL/SQL Subprogram DBMS_UTILITY.EXPAND_SQL_TEXT
● The $$PLSQL_OWNER and $$PLSQL_TYPE predefined PL/SQL inquiry directives are supported in Oracle 12c
Support for Oracle Database 12Support for Oracle Database 12cc
SQL Translation FrameworkSQL Translation Framework
Data Redaction SupportData Redaction Support
Simplifying development and management in the Oracle Database
Oracle SQL Developer
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
APEX AdministrationAPEX Administration
Cloud Database SupportCloud Database Support
Manage Pluggable DatabasesManage Pluggable Databases
Oracle Database 12c: Pluggable DatabasesSQL Developer Release 3.2
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle Database 12c: Pluggable Databases
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Oracle Data RedactionExample: Partial
Before
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
After
In Database Archiving
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
In-Database Archiving
• Applications typically work with recent data
– But often need to retain data for 5 to 10 years
• Can potentially improve upgrade times as only data that is active is modified
• In-DB Archiving provides the ability to archive infrequently used data
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
• In-DB Archiving provides the ability to archive infrequently used data within the database
– Archived Data is invisible by default
• Archived data remains online for historical analysis
In-Database Archiving
Enable In-Database Archiving on the Sales Table
ALTER TABLE SALES ROW ARCHIVAL; ALTER TABLE SALES ROW ARCHIVAL;
UPDATE SALES set ORA_ARCHIVE_STATE = 1;UPDATE SALES set ORA_ARCHIVE_STATE = 1;
Archive the rows with a non zero value (null, -1, 1 etc.)
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
UPDATE SALES set ORA_ARCHIVE_STATE = 1;UPDATE SALES set ORA_ARCHIVE_STATE = 1;
ALTER SESSION SET ROW ARCHIVAL VISIBILITY = ALL;ALTER SESSION SET ROW ARCHIVAL VISIBILITY = ALL;
Modify your session to see all rows including archived versions
Oracle Application Development Summary
• Oracle provides a rich development experience with support for a wide range of languages and approaches
• Oracle Database 12c continues to improve on the developer’s experience by providing improved tools and APIs
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
by providing improved tools and APIs
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
Recommended