SlideShare a Scribd company logo
IEEE Day 2013
Ramin Orujov
ICT/Internal Applications Team Head
Azercell Telecom
SCJP 6, OCE Java EE 6 WCD
www.linkedin.com/in/raminorujov
01 October 2013, Qafqaz University
Oracle database 12c:
New features for
developers
About me
Senior software developer
Internal Applications Team Head@Azercell
Teacher @ Qafqaz University CE dept.
Co-manager of AZEROUG
Founder and manager of AZERJUG
October 1, 20132
Oracle database platforms
Oracle 9i – internet
Oracle 10g/11g – grid
Oracle 12c - cloud
http://www.oracle.com/us/products/databas
http://www.oracle.com/technetwork/databas
October 1, 20133
SQL new features
 SEQUENCE as default column value
 IDENTITY column
 VARCHAR2, NVARCHAR2 32K limit
 LIMIT, OFFSET support for paging
 Invisible column support
 Inline PL/SQL function within SQL
WITH expression
October 1, 20134
SEQUENCE as default col value
create sequence test_seq
start with 1
increment by 1;
create table test_table(
id number default test_seq.nextval
primary key
);
http://docs.oracle.com/cd/E16655_01/server
SQLRF54458
October 1, 20135
IDENTITY column
MySQL,MS SQL Server auto increment/identity
create table test_table(
id number generated by default on null as
identity,
name varchar2(10)
)
insert into test_table(name) values(‘ramin’)
insert into test_table(id,name) values(null,
‘ramin’)
http://docs.oracle.com/cd/E16655_01/gateways.121/
DRDAA109
October 1, 20136
VARCHAR2,NVARCHAR2 32K limit
32767 character support
VARCHAR2, NVARCHAR2, RAW
Initialization param
MAX_STRING_SIZE = EXTENDED
http://docs.oracle.com/cd/E16655_01/server
October 1, 20137
LIMIT, OFFSET support
select *
from (
select rownum rn, id, e.*
from employees e
)
where rn between 1 AND 10
order by 1;
October 1, 20138
LIMIT, OFFSET support
October 1, 20139
LIMIT, OFFSET support
October 1, 201310
SELECT employee_id, last_name
FROM employees
ORDER BY salary
FETCH FIRST 10 ROWS ONLY;
SELECT employee_id, last_name
FROM employees
ORDER BY salary
OFFSET 5 ROWS FETCH NEXT 10 ROWS
ONLY;
LIMIT, OFFSET support
October 1, 201311
SELECT employee_id, last_name, salary
FROM employees
ORDER BY salary
FETCH FIRST 5 PERCENT ROWS WITH TIES;
http://docs.oracle.com/cd/E16655_01/server.121
Invisible column
October 1, 201312
create table app_user(
id number generated by default on
null as identity,
username varchar2(100) not null,
passwd varchar(100) invisible
);
select * from app_user;
http://docs.oracle.com/cd/E16655_01/server
Inline PL/SQL function WITH
October 1, 201313
with
function sqr(p_num in number)
return number
is
begin
return p_num * p_num;
end;
select u.user_id, sqr(u.user_id) from all_users
where rownum <= 10;
2.5-3x performance improvement
http://docs.oracle.com/cd/E16655_01/server.121/e17
PL/SQL new features
October 1, 201314
 New way for returning cursor
 Modularity with ACCESSIBLE BY
 New UTL_CALL_STACK package
 Using PL/SQL types in SQL context
 Result cache support for functions with
invoker’s right
New way for returning cursor
October 1, 201315
create procedure get_customer_order_list
as
cur_customer sys_refcursor;
cur_order sys_refcursor;
begin
open cur_customer for
select * from customer;
open cur_order for
select * from order;
dbms_sql.return_result(cur_customer);
dbms_sql.return_result(cur_order);
end;
New way for returning cursor
October 1, 201316
// sample JDBC code
String sql = “begin get_customer_order_list; end;”;
Connection con = datasource.getConnection();
PreparedStatement ps = con.prepareStatement();
ps.executeQuery(sql);
while(ps.getMoreResults()) {
ResultSet rs = ps.getResultSet();
while(rs.next()) {
… read columns
}
}
Modularity with ACCESSIBLE BY
October 1, 201317
package pkg_api;
package pkg_api_utility;
pkg_api_utility is considered to be used only by
pkg_api
ACCESSİBLE BY
Modularity with ACCESSIBLE BY
October 1, 201318
CREATE OR REPLACE PACKAGE pkg_api_utility
ACCESSIBLE BY (pkg_api)
IS
PROCEDURE h1;
PROCEDURE h2;
END pkg_api_utility;
CREATE OR REPLACE PACKAGE BODY pkg_api_utility
IS
PROCEDURE h1 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Helper procedure h1');
END;
PROCEDURE h2 IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Helper procedure h2');
END;
END pkg_api_utility;
Modularity with ACCESSIBLE BY
October 1, 201319
begin
pkg_api.p1;
pkg_api.p2;
end;
begin
pkg_api_utility.h1;
pkg_api_utility.h2;
end;
ORA-06550
PLS-00904: insufficient privilege to access object
PKG_API_UTILITY
UTL_CALLSTACK package
October 1, 201320
DBMS_UTILITY functions related to call/error stack:
–FORMAT_CALL_STACK
–FORMAT_ERROR_STACK
–FORMAT_ERROR_BACKTRACE
New package: UTL_CALLSTACK
http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/
Result cache support for functions
with invoker’s right
October 1, 201321
In Oracle Database 11g Release 2 (11.2),
only definer's rights PL/SQL functions could
be result cached.
Now, invoker's rights PL/SQL functions can
also be result cached. (The identity of the
invoking user is implicitly added to the key of
the result.)
http://docs.oracle.com/cd/E16655_01/appde
v.121/e17622/release_changes.htm#LNPLS1
10
Java new features
October 1, 201322
 PL/SQL boolean support in JDBC driver
 PL/SQL package level collection
support
Package level collection support
October 1, 201323
create or replace package TEST_PKG is
type V_TYP is varray(10) of
varchar2(200);
type R_TYP is record(c1 pls_integer, c2
varchar2(100));
procedure VARR_PROC(p1 in V_TYP, p2
OUT V_TYP);
procedure REC_PROC(p1 in R_TYP, p2
OUT R_TYP);
end;
/
Package level collection support
October 1, 201324
create or replace package body TEST_PKG is
procedure VARR_PROC(p1 in V_TYP,
p2 OUT V_TYP) is
begin
p2 := p1;
end;
procedure REC_PROC(p1 in R_TYP,
p2 OUT R_TYP) is
begin
p2 := p1;
end;
end;
JDBC code
October 1, 201325
CallableStatement cstmt = null;
try {
cstmt = conn.prepareCall("{ call
TEST_PKG.VARR_PROC(?,?) }");
Array arr =
((OracleConnection)conn).createArray("TEST_PKG.V_
TYP", new String[]{"A", "B"});
cstmt.setArray(1, arr);
cstmt.registerOutParameter(2, Types.ARRAY,
"TEST_PKG.V_TYP");
cstmt.execute();
//get PLSQL VARRAY type out parameter value
Array outArr = cstmt.getArray(2);
} catch( Exception e) {
e.printStackTrace();
}
JDBC code
October 1, 201326
try {
cstmt = conn.prepareCall("{ call
TEST_PKG.REC_PROC(?,?) }");
//PLSQL RECORD type binding
Struct struct =
conn.createStruct("TEST_PKG.R_TYP", new Object[]
{12345, "B"});
cstmt.setObject(1, struct);
cstmt.registerOutParameter(2, Types.STRUCT,
"TEST_PKG.R_TYP");
cstmt.execute();
//get PLSQL RECORD type out parameter value
Struct outStruct = (Struct)cstmt.getObject(2);
} catch( Exception e) {
e.printStackTrace();
}
JDBC code
October 1, 201327
CREATE OR REPLACE PACKAGE PACK1 AS
TYPE EMPLOYEE_ROWTYPE_ARRAY IS TABLE OF
EMPLOYEES%ROWTYPE;
END PACK1;
CallableStatement cstmt = conn.prepareCall("BEGIN
SELECT * BULK COLLECT INTO :1 FROM EMPLOYEE;
END;");
cstmt.registerOutParameter(1,OracleTypes.ARRAY,
"PACK1.EMPLOYEE_ROWTYPE_ARRAY");
cstmt.execute();
Array a = cstmt.getArray(1);
References
October 1, 201328
 http://docs.oracle.com/cd/E16655_01/appdev.121
/e17622/release_changes.htm
 http://www.toadworld.com/platforms/oracle/b/we
blog/archive/2013/07/01/oracle-database-12c-
new-pl-sql-features.aspx
 http://docs.oracle.com/cd/E16655_01/java.121/e1
7657/apxref.htm#CHEIIJCC
 http://www.oracle-base.com/articles/12c/with-
clause-enhancements-12cr1.php
Q&A
?

More Related Content

PPTX
PL/SQL User-Defined Functions in the Read World
PPTX
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
PDF
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
PPTX
A New View of Database Views
PDF
[스프링/Spring교육학원,자바교육,근로자교육,실업자교육추천학원_탑크리에듀]#6.스프링프레임워크 & 마이바티스 (Spring Framew...
PPTX
12c Mini Lesson - Improved Error Handling in PLSQL
PDF
Oracle 11g PL/SQL notes
PPTX
Why is the application running so slowly?
PL/SQL User-Defined Functions in the Read World
Hidden Gems of Performance Tuning: Hierarchical Profiler and DML Trigger Opti...
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
A New View of Database Views
[스프링/Spring교육학원,자바교육,근로자교육,실업자교육추천학원_탑크리에듀]#6.스프링프레임워크 & 마이바티스 (Spring Framew...
12c Mini Lesson - Improved Error Handling in PLSQL
Oracle 11g PL/SQL notes
Why is the application running so slowly?

What's hot (20)

PDF
SQL Tracing
PDF
#29.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
PDF
Php 7.2 compliance workshop php benelux
PDF
Bypass dbms assert
PDF
#18.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...
PDF
JavaFX Pitfalls
PPTX
Oracle RDBMS Workshop (Part1)
PDF
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
KEY
PHPUnit testing to Zend_Test
PDF
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
PDF
Triggers and Stored Procedures
KEY
Php Unit With Zend Framework Zendcon09
PDF
JavaFX – 10 things I love about you
PDF
Using OTP and gen_server Effectively
PPT
Download It
PPTX
Data Tracking: On the Hunt for Information about Your Database
PDF
Perl Sucks - and what to do about it
PPT
Pl sql guide
PDF
50 new features of Java EE 7 in 50 minutes
PPTX
Managing Unstructured Data: Lobs in the World of JSON
SQL Tracing
#29.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
Php 7.2 compliance workshop php benelux
Bypass dbms assert
#18.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원IT학원/실업자/재직자환급교육/자바/스프링/...
JavaFX Pitfalls
Oracle RDBMS Workshop (Part1)
#11.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_국비지원학원,재직자/실업자교육학원,스프링교육,마이바...
PHPUnit testing to Zend_Test
(국비지원학원/재직자교육/실업자교육/IT실무교육_탑크리에듀)#4.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)
Triggers and Stored Procedures
Php Unit With Zend Framework Zendcon09
JavaFX – 10 things I love about you
Using OTP and gen_server Effectively
Download It
Data Tracking: On the Hunt for Information about Your Database
Perl Sucks - and what to do about it
Pl sql guide
50 new features of Java EE 7 in 50 minutes
Managing Unstructured Data: Lobs in the World of JSON
Ad

Viewers also liked (20)

PPTX
Oracle Database 12c new features for the developers.
PPTX
Best practices for RESTful web service design
PPTX
İxtisas Seçimi və Sertifikatlar
PPTX
İxtisas Seçimi və Sertifikatlar - Şəbəkə - Cisco
PPTX
AZEROUG ilk gorus
PPT
İKT sahəsindəki beynəlxalq sertifikatlar və onların önəmi - Qafqaz Universite...
PPTX
İKT sahəsində əsas i̇stiqamətlər və i̇ş i̇mkanları
PPTX
Startup'tan E-ticaret Devi Olmak: SEO Altyapısını Oluştururken Google'ı Doğru...
PDF
Test Driven Development
PDF
Rulesimple Hizmetlerimiz
DOCX
Syllabus ref02
PPT
Introduction
PPTX
Kullanıcı Deneyimi & Kullanılabilirlik
PDF
Pruebas exploratorias
PPTX
2013 Scrum Gathering Keynote: Buy or build — where did your agile come from?
PDF
Cooking an ontology-based spoken dialogue system
PPTX
Seminar on mobile os
PDF
Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri
PPTX
Selendroid in Action
PPTX
The importance of internet usage as a marketing tool in the studies of sports...
Oracle Database 12c new features for the developers.
Best practices for RESTful web service design
İxtisas Seçimi və Sertifikatlar
İxtisas Seçimi və Sertifikatlar - Şəbəkə - Cisco
AZEROUG ilk gorus
İKT sahəsindəki beynəlxalq sertifikatlar və onların önəmi - Qafqaz Universite...
İKT sahəsində əsas i̇stiqamətlər və i̇ş i̇mkanları
Startup'tan E-ticaret Devi Olmak: SEO Altyapısını Oluştururken Google'ı Doğru...
Test Driven Development
Rulesimple Hizmetlerimiz
Syllabus ref02
Introduction
Kullanıcı Deneyimi & Kullanılabilirlik
Pruebas exploratorias
2013 Scrum Gathering Keynote: Buy or build — where did your agile come from?
Cooking an ontology-based spoken dialogue system
Seminar on mobile os
Oracle 11g PL/SQL proqramlamlaşdırma yenilikləri
Selendroid in Action
The importance of internet usage as a marketing tool in the studies of sports...
Ad

Similar to IEEE Day 2013 Oracle Database 12c: new features for developers (20)

PPTX
Relational Database Management System
PDF
Exploring plsql new features best practices september 2013
PPTX
Oracle Database 12c - New Features for Developers and DBAs
PPTX
Oracle Database 12c - New Features for Developers and DBAs
PDF
Manual Tecnico OGG Oracle to MySQL
PPTX
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
PPTX
New PLSQL in Oracle Database 12c
PPT
Cloug Undocumented Secrets Black Magic
PDF
Improving the Performance of PL/SQL function calls from SQL
PPT
07 Using Oracle-Supported Package in Application Development
PDF
4. plsql 1
DOC
Awr report error
PDF
What’s New in Oracle Database 12c for PHP
PPTX
10053 otw
PPTX
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
PPTX
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
PPTX
Oracle database 12.2 new features
PPTX
Crack the complexity of oracle applications r12 workload v2
PPT
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
PDF
Oracle db subprograms
Relational Database Management System
Exploring plsql new features best practices september 2013
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
Manual Tecnico OGG Oracle to MySQL
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
New PLSQL in Oracle Database 12c
Cloug Undocumented Secrets Black Magic
Improving the Performance of PL/SQL function calls from SQL
07 Using Oracle-Supported Package in Application Development
4. plsql 1
Awr report error
What’s New in Oracle Database 12c for PHP
10053 otw
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
Oracle database 12.2 new features
Crack the complexity of oracle applications r12 workload v2
Tony Jambu (obscure) tools of the trade for tuning oracle sq ls
Oracle db subprograms

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Machine learning based COVID-19 study performance prediction
PPTX
sap open course for s4hana steps from ECC to s4
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
Teaching material agriculture food technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Empathic Computing: Creating Shared Understanding
PDF
Approach and Philosophy of On baking technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Review of recent advances in non-invasive hemoglobin estimation
Chapter 3 Spatial Domain Image Processing.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Programs and apps: productivity, graphics, security and other tools
Machine learning based COVID-19 study performance prediction
sap open course for s4hana steps from ECC to s4
NewMind AI Weekly Chronicles - August'25 Week I
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectral efficient network and resource selection model in 5G networks
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
MYSQL Presentation for SQL database connectivity
Empathic Computing: Creating Shared Understanding
Approach and Philosophy of On baking technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Review of recent advances in non-invasive hemoglobin estimation

IEEE Day 2013 Oracle Database 12c: new features for developers

  • 1. IEEE Day 2013 Ramin Orujov ICT/Internal Applications Team Head Azercell Telecom SCJP 6, OCE Java EE 6 WCD www.linkedin.com/in/raminorujov 01 October 2013, Qafqaz University Oracle database 12c: New features for developers
  • 2. About me Senior software developer Internal Applications Team Head@Azercell Teacher @ Qafqaz University CE dept. Co-manager of AZEROUG Founder and manager of AZERJUG October 1, 20132
  • 3. Oracle database platforms Oracle 9i – internet Oracle 10g/11g – grid Oracle 12c - cloud http://www.oracle.com/us/products/databas http://www.oracle.com/technetwork/databas October 1, 20133
  • 4. SQL new features  SEQUENCE as default column value  IDENTITY column  VARCHAR2, NVARCHAR2 32K limit  LIMIT, OFFSET support for paging  Invisible column support  Inline PL/SQL function within SQL WITH expression October 1, 20134
  • 5. SEQUENCE as default col value create sequence test_seq start with 1 increment by 1; create table test_table( id number default test_seq.nextval primary key ); http://docs.oracle.com/cd/E16655_01/server SQLRF54458 October 1, 20135
  • 6. IDENTITY column MySQL,MS SQL Server auto increment/identity create table test_table( id number generated by default on null as identity, name varchar2(10) ) insert into test_table(name) values(‘ramin’) insert into test_table(id,name) values(null, ‘ramin’) http://docs.oracle.com/cd/E16655_01/gateways.121/ DRDAA109 October 1, 20136
  • 7. VARCHAR2,NVARCHAR2 32K limit 32767 character support VARCHAR2, NVARCHAR2, RAW Initialization param MAX_STRING_SIZE = EXTENDED http://docs.oracle.com/cd/E16655_01/server October 1, 20137
  • 8. LIMIT, OFFSET support select * from ( select rownum rn, id, e.* from employees e ) where rn between 1 AND 10 order by 1; October 1, 20138
  • 10. LIMIT, OFFSET support October 1, 201310 SELECT employee_id, last_name FROM employees ORDER BY salary FETCH FIRST 10 ROWS ONLY; SELECT employee_id, last_name FROM employees ORDER BY salary OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY;
  • 11. LIMIT, OFFSET support October 1, 201311 SELECT employee_id, last_name, salary FROM employees ORDER BY salary FETCH FIRST 5 PERCENT ROWS WITH TIES; http://docs.oracle.com/cd/E16655_01/server.121
  • 12. Invisible column October 1, 201312 create table app_user( id number generated by default on null as identity, username varchar2(100) not null, passwd varchar(100) invisible ); select * from app_user; http://docs.oracle.com/cd/E16655_01/server
  • 13. Inline PL/SQL function WITH October 1, 201313 with function sqr(p_num in number) return number is begin return p_num * p_num; end; select u.user_id, sqr(u.user_id) from all_users where rownum <= 10; 2.5-3x performance improvement http://docs.oracle.com/cd/E16655_01/server.121/e17
  • 14. PL/SQL new features October 1, 201314  New way for returning cursor  Modularity with ACCESSIBLE BY  New UTL_CALL_STACK package  Using PL/SQL types in SQL context  Result cache support for functions with invoker’s right
  • 15. New way for returning cursor October 1, 201315 create procedure get_customer_order_list as cur_customer sys_refcursor; cur_order sys_refcursor; begin open cur_customer for select * from customer; open cur_order for select * from order; dbms_sql.return_result(cur_customer); dbms_sql.return_result(cur_order); end;
  • 16. New way for returning cursor October 1, 201316 // sample JDBC code String sql = “begin get_customer_order_list; end;”; Connection con = datasource.getConnection(); PreparedStatement ps = con.prepareStatement(); ps.executeQuery(sql); while(ps.getMoreResults()) { ResultSet rs = ps.getResultSet(); while(rs.next()) { … read columns } }
  • 17. Modularity with ACCESSIBLE BY October 1, 201317 package pkg_api; package pkg_api_utility; pkg_api_utility is considered to be used only by pkg_api ACCESSİBLE BY
  • 18. Modularity with ACCESSIBLE BY October 1, 201318 CREATE OR REPLACE PACKAGE pkg_api_utility ACCESSIBLE BY (pkg_api) IS PROCEDURE h1; PROCEDURE h2; END pkg_api_utility; CREATE OR REPLACE PACKAGE BODY pkg_api_utility IS PROCEDURE h1 IS BEGIN DBMS_OUTPUT.PUT_LINE('Helper procedure h1'); END; PROCEDURE h2 IS BEGIN DBMS_OUTPUT.PUT_LINE('Helper procedure h2'); END; END pkg_api_utility;
  • 19. Modularity with ACCESSIBLE BY October 1, 201319 begin pkg_api.p1; pkg_api.p2; end; begin pkg_api_utility.h1; pkg_api_utility.h2; end; ORA-06550 PLS-00904: insufficient privilege to access object PKG_API_UTILITY
  • 20. UTL_CALLSTACK package October 1, 201320 DBMS_UTILITY functions related to call/error stack: –FORMAT_CALL_STACK –FORMAT_ERROR_STACK –FORMAT_ERROR_BACKTRACE New package: UTL_CALLSTACK http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/
  • 21. Result cache support for functions with invoker’s right October 1, 201321 In Oracle Database 11g Release 2 (11.2), only definer's rights PL/SQL functions could be result cached. Now, invoker's rights PL/SQL functions can also be result cached. (The identity of the invoking user is implicitly added to the key of the result.) http://docs.oracle.com/cd/E16655_01/appde v.121/e17622/release_changes.htm#LNPLS1 10
  • 22. Java new features October 1, 201322  PL/SQL boolean support in JDBC driver  PL/SQL package level collection support
  • 23. Package level collection support October 1, 201323 create or replace package TEST_PKG is type V_TYP is varray(10) of varchar2(200); type R_TYP is record(c1 pls_integer, c2 varchar2(100)); procedure VARR_PROC(p1 in V_TYP, p2 OUT V_TYP); procedure REC_PROC(p1 in R_TYP, p2 OUT R_TYP); end; /
  • 24. Package level collection support October 1, 201324 create or replace package body TEST_PKG is procedure VARR_PROC(p1 in V_TYP, p2 OUT V_TYP) is begin p2 := p1; end; procedure REC_PROC(p1 in R_TYP, p2 OUT R_TYP) is begin p2 := p1; end; end;
  • 25. JDBC code October 1, 201325 CallableStatement cstmt = null; try { cstmt = conn.prepareCall("{ call TEST_PKG.VARR_PROC(?,?) }"); Array arr = ((OracleConnection)conn).createArray("TEST_PKG.V_ TYP", new String[]{"A", "B"}); cstmt.setArray(1, arr); cstmt.registerOutParameter(2, Types.ARRAY, "TEST_PKG.V_TYP"); cstmt.execute(); //get PLSQL VARRAY type out parameter value Array outArr = cstmt.getArray(2); } catch( Exception e) { e.printStackTrace(); }
  • 26. JDBC code October 1, 201326 try { cstmt = conn.prepareCall("{ call TEST_PKG.REC_PROC(?,?) }"); //PLSQL RECORD type binding Struct struct = conn.createStruct("TEST_PKG.R_TYP", new Object[] {12345, "B"}); cstmt.setObject(1, struct); cstmt.registerOutParameter(2, Types.STRUCT, "TEST_PKG.R_TYP"); cstmt.execute(); //get PLSQL RECORD type out parameter value Struct outStruct = (Struct)cstmt.getObject(2); } catch( Exception e) { e.printStackTrace(); }
  • 27. JDBC code October 1, 201327 CREATE OR REPLACE PACKAGE PACK1 AS TYPE EMPLOYEE_ROWTYPE_ARRAY IS TABLE OF EMPLOYEES%ROWTYPE; END PACK1; CallableStatement cstmt = conn.prepareCall("BEGIN SELECT * BULK COLLECT INTO :1 FROM EMPLOYEE; END;"); cstmt.registerOutParameter(1,OracleTypes.ARRAY, "PACK1.EMPLOYEE_ROWTYPE_ARRAY"); cstmt.execute(); Array a = cstmt.getArray(1);
  • 28. References October 1, 201328  http://docs.oracle.com/cd/E16655_01/appdev.121 /e17622/release_changes.htm  http://www.toadworld.com/platforms/oracle/b/we blog/archive/2013/07/01/oracle-database-12c- new-pl-sql-features.aspx  http://docs.oracle.com/cd/E16655_01/java.121/e1 7657/apxref.htm#CHEIIJCC  http://www.oracle-base.com/articles/12c/with- clause-enhancements-12cr1.php
  • 29. Q&A ?