SlideShare a Scribd company logo
1 of 18
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Useful Supplied
PL/SQL Packages
1
Maria Colgan
Master Product Manager
Oracle Database Server Technologies
June 2018
JEFF
@SQLMaria
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_SESSION.SLEEP()
2
Accessible sleep function within PL/SQL
SQL> set timing on;
SQL> DECLARE
v_start date;
v_end date;
BEGIN
v_start := SYSDATE;
-- Sleep for 10 seconds
dbms_lock.sleep(10);
v_end := SYSDATE;
END;
/
PL/SQL procedure successfully
completed.
Elapsed: 00:00:10.02
• DBMS_LOCK includes other, more
sensitive methods
• Therefore not granted to public
• Requires DBA intervention to get a
accessible sleep function in PL/SQL
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_SESSION.SLEEP()
3
Accessible sleep function within PL/SQL
SQL> set timing on;
SQL> DECLARE
v_start date;
v_end date;
BEGIN
v_start := SYSDATE;
-- Sleep for 10 seconds
DBMS_SESSION.SLEEP(10);
v_end := SYSDATE;
END;
/
PL/SQL procedure successfully
completed.
Elapsed: 00:00:10.02
• Doesn’t require GRANT anymore
– Before required explicit grant on
DBMS_LOCK
– DBMS_SESSION granted to public
• Compatible with DBMS_LOCK.SLEEP
– You can search/replace
• Introduced thanks to the Oracle
community
– https://community.oracle.com/ideas/4852
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_UTILITY.EXPAND_SQL_TEXT
4
SELECT view_name
FROM user_views
WHERE view_name LIKE 'SALE%';
VIEW_NAME
-------------------
SALES_REPORTING2_V
SALES_REPORTING_V
Determining if this really is the right view to use
12c
• Views can be a useful way to hide
complexity from developers
• But they can also cause problems
• It's easy to write apparently simple
statements, that result in extremely
complex SQL being sent to the database
• The DBMS_UTILITY.EXPAND_SQL_TEXT
procedure expands references to views,
turning them into subqueries in the
original statement
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_UTILITY.EXPAND_SQL_TEXT
set serveroutput on
DECLARE
l_clob CLOB;
BEGIN
dbms_utility.Expand_sql_text(
input_sql_text =>'SELECT * FROM SALES_REPORTING_V',
output_sql_text => l_clob);
dbms_output.Put_line(l_clob);
END;
/
5
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_UTILITY.EXPAND_SQL_TEXT
SELECT "A1"."order_id" "ORDER_ID",
"A1"."time_id" "TIME_ID",
"A1"."cust_id" "CUST_ID",
"A1"."prod_id" "PROD_ID"
FROM (SELECT "A3"."order_id" "ORDER_ID",
"A3"."time_id" "TIME_ID",
"A3"."cust_id" "CUST_ID",
"A3"."prod_id" "PROD_ID"
FROM "SH"."sales" "A3",
"SH"."products" "A2"
WHERE "A3"."prod_id" = "A2"."prod_id") "A1"
6
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_UTILITY.EXPAND_SQL_TEXT
set serveroutput on
DECLARE
l_clob CLOB;
BEGIN
dbms_utility.Expand_sql_text(
input_sql_text =>'SELECT * FROM SALES_REPORTING2_V',
output_sql_text => l_clob);
dbms_output.Put_line(l_clob);
END;
/
7
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_UTILITY.EXPAND_SQL_TEXT
SELECT "A1"."order_id" "ORDER_ID",
"A1"."time_id" "TIME_ID",
"A1"."cust_id" "CUST_ID",
"A1"."prod_id" "PROD_ID"
FROM (SELECT "A2"."order_id" "ORDER_ID",
"A2"."time_id" "TIME_ID",
"A2"."cust_id" "CUST_ID",
"A2"."prod_id" "PROD_ID"
FROM "SH"."sales" "A2”) "A1"
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_ADVANCED_REWRITE
9
Fixing the unfixable SQL statement
• You’ve been told you need to “fix” a
SQL statement that is no longer
returning results in the correct order
• But you can’t change the application
code directly as that would require
down time
• What do you do?
SQL> SELECT x, y, sum(z) FROM t
GROUP BY x, y;
X Y SUM(Z)
---------- ---------- ----------
1 4 110
2 3 84
10g
Something changes and now you get
SQL> SELECT x, y, sum(z) FROM t
GROUP BY x, y;
X Y SUM(Z)
---------- ---------- ----------
2 3 84
1 4 110
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_ADVANCED_REWRITE
10
Fixing the unfixable SQL statement
Step 1
• Check what changed with the
execution plan
ORIGINIAL PLAN
-----------------------------------
| Id | Operation | Name |
-----------------------------------
| 0 | SELECT STATEMENT | |
| 1 | HASH GROUP BY | |
| 2 | TABLE ACCESS FULL| T |
-----------------------------------
NEW PLAN
--------------------------------------
| Id | Operation | Name |
--------------------------------------
| 0 | SELECT STATEMENT | |
| 1 | SORT GROUP BY NOSORT| |
| 2 | INDEX FULL SCAN |T_IDX |
--------------------------------------
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_ADVANCED_REWRITE
11
Fixing the unfixable SQL statement
Step 2
• Check the order of the columns in the
index
SQL> SELECT column_position,
column_name
FROM user_ind_columns
WHERE index_name='T_IDX'
ORDER BY column_position;
COLUMN_POSITION COLUMN
--------------- ------
1 Y
2 X
3 Z
• New index returns the rows in a
different order because its sorted on
column Y rather than X
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_ADVANCED_REWRITE
12
Fixing the unfixable SQL statement
Step 3
• Create a view v that includes an order
by clause so the query results will
always be order based on the values
column x
SQL> CREATE OR REPLACE VIEW v
2 AS
3 SELECT x, y, sum(z) "SUM(Z)"
4 FROM t
5 GROUP BY x, y
6 ORDER BY x, y;
View created.
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_ADVANCED_REWRITE
13
Fixing the unfixable SQL statement
Step 4
• Use the DBMS_ADVANCED_REWRITE procedure to map the original query
to a simple SELECT * FROM v;
SQL> BEGIN
2 sys.dbms_advanced_rewrite.declare_rewrite_equivalence(
3 name => 'DEMO_TIME',
4 source_stmt => 'SELECT x, y, sum(z) FROM t GROUP BY x, y',
5 destination_stmt => 'SELECT * FROM v',
6 validate => FALSE,
7 rewrite_mode => 'TEXT_MATCH');
8 END;
9 /
PL/SQL procedure successfully completed.
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_ADVANCED_REWRITE
14
Fixing the unfixable SQL statement
• Each time our original SQL statement
is issued the
DBMS_ADVANCED_REWRITE
procedure rewrites it to be
SELECT * FROM v;
• Always get the query
output in an order list
SQL> SELECT x, y, sum(z) FROM t
GROUP BY x, y;
X Y SUM(Z)
---------- ---------- ----------
1 4 110
2 3 84
-----------------------------------
| Id | Operation | Name |
-----------------------------------
| 0 | SELECT STATEMENT | |
| 1 | VIEW | V |
| 2 | SORT GROUP BY | |
| 3 | INDEX FULL SCAN|T_IDX |
-----------------------------------
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_COMPARISON
• Trying to figure out why things behave
differently in production then they do in
test can be time consuming and painful
• The DBMS_COMPARISON package allows
you to compare objects, schemas or data
between databases or schemas
• For a table comparison you do need a
unique index on both tables
• Begin by creating the comparison
15
Figuring out why production is different to test
SQL> BEGIN
DBMS_COMPARISON.CREATE_COMPARISON
(
comparison_name => 'COMP_SALES',
schema_name => 'SH',
object_name => 'SALES',
dblink_name => 'orcl2_test'
);
END;
/
11g
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_COMPARISON
• Execute the
COMPARE function
to perform the
compare operation
• Returns a boolean to
say if there is or is not
consistency
• The scan_id allows
you to find out what
the differences are
16
SQL> DECLARE
scan_info DBMS_COMPARISON.COMPARISON_TYPE;
BEGIN
IF NOT DBMS_COMPARISON.COMPARE
( comparison_name => 'COMP_SALES'
, scan_info => scan_info
, perform_row_dif => TRUE
) THEN
DBMS_OUTPUT.PUT_LINE('Scan ID:'||
scan_info.scan_id);
END IF;
END;
/
Scan ID: 1
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
DBMS_COMPARISON
17
SELECT c.COLUMN_NAME, r.INDEX_VALUE,
case when r.LOCAL_ROWID is null then ‘No’ else 'Yes’ end LOCAL,
Case when r.REMOTE_ROWID is null then 'No’ else 'Yes’ end REMOTE
FROM USER_COMPARISON_COLUMNS c, USER_COMPARISON_ROW_DIF r,
USER_COMPARISON_SCAN s
WHERE c.COMPARISON_NAME = 'COMP_SALES‘
AND c.INDEX_COLUMN = 'Y’
AND r.STATUS = 'DIF’
AND c.COMPARISON_NAME = r.COMPARISON_NAME
AND r.SCAN_ID = s.SCAN_ID
AND s.SCAN_ID = 1
ORDER BY r.INDEX_VALUE;
COLUMN_NAME INDEX_VALUE LOCAL REMOTE
----------- ----------- ----- ------
TAX_CODE 0.05 No Yes
Test environment has an different tax code
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Many More Powerful Supplied PL/SQL Packages
• Oracle Database 18c provides 300 PL/SQL packages
• Some of my favorites include:
– DBMS_STATS
– DBMS_SHARED_POOL
– DBMS_SPM
– DBMS_AUTO_TASK_ADMIN
– DBMS_SQLTUNE
• Check out more details in the PL/SQL Packages and Types Reference
18

More Related Content

What's hot

The Changing Role of a DBA in an Autonomous World
The Changing Role of a DBA in an Autonomous WorldThe Changing Role of a DBA in an Autonomous World
The Changing Role of a DBA in an Autonomous WorldMaria Colgan
 
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse SupportOracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse Supportnkarag
 
Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14Alex Zaballa
 
Sql parametrized queries
Sql parametrized queriesSql parametrized queries
Sql parametrized queriesHadi Fadlallah
 
Creating Views - oracle database
Creating Views - oracle databaseCreating Views - oracle database
Creating Views - oracle databaseSalman Memon
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsNirav Shah
 
One Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic IndexingOne Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic IndexingJim Czuprynski
 
Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015 Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015 Alex Zaballa
 
Oracle Course
Oracle CourseOracle Course
Oracle Courserspaike
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data RedactionIvica Arsov
 
The Database Environment Chapter 8
The Database Environment Chapter 8The Database Environment Chapter 8
The Database Environment Chapter 8Jeanie Arnoco
 
Oracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practicesOracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practicesSmitha Padmanabhan
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data RedactionAlex Zaballa
 
Oracle DB Performance Tuning Tips
Oracle DB Performance Tuning TipsOracle DB Performance Tuning Tips
Oracle DB Performance Tuning TipsAsanka Dilruk
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012Eduardo Castro
 
Aggregating Data Using Group Functions
Aggregating Data Using Group FunctionsAggregating Data Using Group Functions
Aggregating Data Using Group FunctionsSalman Memon
 
Restricting and Sorting Data - Oracle Data Base
Restricting and Sorting Data - Oracle Data BaseRestricting and Sorting Data - Oracle Data Base
Restricting and Sorting Data - Oracle Data BaseSalman Memon
 

What's hot (20)

The Changing Role of a DBA in an Autonomous World
The Changing Role of a DBA in an Autonomous WorldThe Changing Role of a DBA in an Autonomous World
The Changing Role of a DBA in an Autonomous World
 
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse SupportOracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
 
Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14
 
Sql parametrized queries
Sql parametrized queriesSql parametrized queries
Sql parametrized queries
 
Creating Views - oracle database
Creating Views - oracle databaseCreating Views - oracle database
Creating Views - oracle database
 
Top 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tipsTop 10 Oracle SQL tuning tips
Top 10 Oracle SQL tuning tips
 
One Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic IndexingOne Less Thing For DBAs to Worry About: Automatic Indexing
One Less Thing For DBAs to Worry About: Automatic Indexing
 
Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015 Data Redaction - OTN TOUR LA 2015
Data Redaction - OTN TOUR LA 2015
 
Oracle Course
Oracle CourseOracle Course
Oracle Course
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data Redaction
 
The Database Environment Chapter 8
The Database Environment Chapter 8The Database Environment Chapter 8
The Database Environment Chapter 8
 
Oracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practicesOracle SQL, PL/SQL best practices
Oracle SQL, PL/SQL best practices
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data Redaction
 
Oracle DB Performance Tuning Tips
Oracle DB Performance Tuning TipsOracle DB Performance Tuning Tips
Oracle DB Performance Tuning Tips
 
Database Objects
Database ObjectsDatabase Objects
Database Objects
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
PL/SQL 3 DML
PL/SQL 3 DMLPL/SQL 3 DML
PL/SQL 3 DML
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012
 
Aggregating Data Using Group Functions
Aggregating Data Using Group FunctionsAggregating Data Using Group Functions
Aggregating Data Using Group Functions
 
Restricting and Sorting Data - Oracle Data Base
Restricting and Sorting Data - Oracle Data BaseRestricting and Sorting Data - Oracle Data Base
Restricting and Sorting Data - Oracle Data Base
 

Similar to Useful PL/SQL Supplied Packages

07 Using Oracle-Supported Package in Application Development
07 Using Oracle-Supported Package in Application Development07 Using Oracle-Supported Package in Application Development
07 Using Oracle-Supported Package in Application Developmentrehaniltifat
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
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...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...Alex Zaballa
 
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...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...Alex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
War of the Indices- SQL Server and Oracle
War of the Indices-  SQL Server and OracleWar of the Indices-  SQL Server and Oracle
War of the Indices- SQL Server and OracleKellyn Pot'Vin-Gorman
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...Jürgen Ambrosi
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Alex Zaballa
 
SSMS-waitstats
SSMS-waitstatsSSMS-waitstats
SSMS-waitstatsE Blake
 

Similar to Useful PL/SQL Supplied Packages (20)

07 Using Oracle-Supported Package in Application Development
07 Using Oracle-Supported Package in Application Development07 Using Oracle-Supported Package in Application Development
07 Using Oracle-Supported Package in Application Development
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Les11.ppt
Les11.pptLes11.ppt
Les11.ppt
 
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...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...
 
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...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...
 
plsql les06
 plsql les06 plsql les06
plsql les06
 
Sql views
Sql viewsSql views
Sql views
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
War of the Indices- SQL Server and Oracle
War of the Indices-  SQL Server and OracleWar of the Indices-  SQL Server and Oracle
War of the Indices- SQL Server and Oracle
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
DBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should KnowDBA Commands and Concepts That Every Developer Should Know
DBA Commands and Concepts That Every Developer Should Know
 
Msql
Msql Msql
Msql
 
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
 
Application_Performance_V1
Application_Performance_V1Application_Performance_V1
Application_Performance_V1
 
War of the Indices- SQL vs. Oracle
War of the Indices-  SQL vs. OracleWar of the Indices-  SQL vs. Oracle
War of the Indices- SQL vs. Oracle
 
SSMS-waitstats
SSMS-waitstatsSSMS-waitstats
SSMS-waitstats
 

More from Maria Colgan

Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptxFive_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptxMaria Colgan
 
Part4 Influencing Execution Plans with Optimizer Hints
Part4 Influencing Execution Plans with Optimizer HintsPart4 Influencing Execution Plans with Optimizer Hints
Part4 Influencing Execution Plans with Optimizer HintsMaria Colgan
 
Ground Breakers Romania: Oracle Autonomous Database
Ground Breakers Romania: Oracle Autonomous DatabaseGround Breakers Romania: Oracle Autonomous Database
Ground Breakers Romania: Oracle Autonomous DatabaseMaria Colgan
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19cMaria Colgan
 
Oracle Database in-Memory Overivew
Oracle Database in-Memory OverivewOracle Database in-Memory Overivew
Oracle Database in-Memory OverivewMaria Colgan
 
JSON and the Oracle Database
JSON and the Oracle DatabaseJSON and the Oracle Database
JSON and the Oracle DatabaseMaria Colgan
 
Harnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer HintsHarnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer HintsMaria Colgan
 
Oracle optimizer bootcamp
Oracle optimizer bootcampOracle optimizer bootcamp
Oracle optimizer bootcampMaria Colgan
 
What_to_expect_from_oracle_database_12c
What_to_expect_from_oracle_database_12cWhat_to_expect_from_oracle_database_12c
What_to_expect_from_oracle_database_12cMaria Colgan
 
Oracle database 12c_and_DevOps
Oracle database 12c_and_DevOpsOracle database 12c_and_DevOps
Oracle database 12c_and_DevOpsMaria Colgan
 

More from Maria Colgan (10)

Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptxFive_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
Five_Things_You_Might_Not_Know_About_Oracle_Database_v2.pptx
 
Part4 Influencing Execution Plans with Optimizer Hints
Part4 Influencing Execution Plans with Optimizer HintsPart4 Influencing Execution Plans with Optimizer Hints
Part4 Influencing Execution Plans with Optimizer Hints
 
Ground Breakers Romania: Oracle Autonomous Database
Ground Breakers Romania: Oracle Autonomous DatabaseGround Breakers Romania: Oracle Autonomous Database
Ground Breakers Romania: Oracle Autonomous Database
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
 
Oracle Database in-Memory Overivew
Oracle Database in-Memory OverivewOracle Database in-Memory Overivew
Oracle Database in-Memory Overivew
 
JSON and the Oracle Database
JSON and the Oracle DatabaseJSON and the Oracle Database
JSON and the Oracle Database
 
Harnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer HintsHarnessing the Power of Optimizer Hints
Harnessing the Power of Optimizer Hints
 
Oracle optimizer bootcamp
Oracle optimizer bootcampOracle optimizer bootcamp
Oracle optimizer bootcamp
 
What_to_expect_from_oracle_database_12c
What_to_expect_from_oracle_database_12cWhat_to_expect_from_oracle_database_12c
What_to_expect_from_oracle_database_12c
 
Oracle database 12c_and_DevOps
Oracle database 12c_and_DevOpsOracle database 12c_and_DevOps
Oracle database 12c_and_DevOps
 

Recently uploaded

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Useful PL/SQL Supplied Packages

  • 1. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Useful Supplied PL/SQL Packages 1 Maria Colgan Master Product Manager Oracle Database Server Technologies June 2018 JEFF @SQLMaria
  • 2. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_SESSION.SLEEP() 2 Accessible sleep function within PL/SQL SQL> set timing on; SQL> DECLARE v_start date; v_end date; BEGIN v_start := SYSDATE; -- Sleep for 10 seconds dbms_lock.sleep(10); v_end := SYSDATE; END; / PL/SQL procedure successfully completed. Elapsed: 00:00:10.02 • DBMS_LOCK includes other, more sensitive methods • Therefore not granted to public • Requires DBA intervention to get a accessible sleep function in PL/SQL
  • 3. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_SESSION.SLEEP() 3 Accessible sleep function within PL/SQL SQL> set timing on; SQL> DECLARE v_start date; v_end date; BEGIN v_start := SYSDATE; -- Sleep for 10 seconds DBMS_SESSION.SLEEP(10); v_end := SYSDATE; END; / PL/SQL procedure successfully completed. Elapsed: 00:00:10.02 • Doesn’t require GRANT anymore – Before required explicit grant on DBMS_LOCK – DBMS_SESSION granted to public • Compatible with DBMS_LOCK.SLEEP – You can search/replace • Introduced thanks to the Oracle community – https://community.oracle.com/ideas/4852
  • 4. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_UTILITY.EXPAND_SQL_TEXT 4 SELECT view_name FROM user_views WHERE view_name LIKE 'SALE%'; VIEW_NAME ------------------- SALES_REPORTING2_V SALES_REPORTING_V Determining if this really is the right view to use 12c • Views can be a useful way to hide complexity from developers • But they can also cause problems • It's easy to write apparently simple statements, that result in extremely complex SQL being sent to the database • The DBMS_UTILITY.EXPAND_SQL_TEXT procedure expands references to views, turning them into subqueries in the original statement
  • 5. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_UTILITY.EXPAND_SQL_TEXT set serveroutput on DECLARE l_clob CLOB; BEGIN dbms_utility.Expand_sql_text( input_sql_text =>'SELECT * FROM SALES_REPORTING_V', output_sql_text => l_clob); dbms_output.Put_line(l_clob); END; / 5
  • 6. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_UTILITY.EXPAND_SQL_TEXT SELECT "A1"."order_id" "ORDER_ID", "A1"."time_id" "TIME_ID", "A1"."cust_id" "CUST_ID", "A1"."prod_id" "PROD_ID" FROM (SELECT "A3"."order_id" "ORDER_ID", "A3"."time_id" "TIME_ID", "A3"."cust_id" "CUST_ID", "A3"."prod_id" "PROD_ID" FROM "SH"."sales" "A3", "SH"."products" "A2" WHERE "A3"."prod_id" = "A2"."prod_id") "A1" 6
  • 7. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_UTILITY.EXPAND_SQL_TEXT set serveroutput on DECLARE l_clob CLOB; BEGIN dbms_utility.Expand_sql_text( input_sql_text =>'SELECT * FROM SALES_REPORTING2_V', output_sql_text => l_clob); dbms_output.Put_line(l_clob); END; / 7
  • 8. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_UTILITY.EXPAND_SQL_TEXT SELECT "A1"."order_id" "ORDER_ID", "A1"."time_id" "TIME_ID", "A1"."cust_id" "CUST_ID", "A1"."prod_id" "PROD_ID" FROM (SELECT "A2"."order_id" "ORDER_ID", "A2"."time_id" "TIME_ID", "A2"."cust_id" "CUST_ID", "A2"."prod_id" "PROD_ID" FROM "SH"."sales" "A2”) "A1" 8
  • 9. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_ADVANCED_REWRITE 9 Fixing the unfixable SQL statement • You’ve been told you need to “fix” a SQL statement that is no longer returning results in the correct order • But you can’t change the application code directly as that would require down time • What do you do? SQL> SELECT x, y, sum(z) FROM t GROUP BY x, y; X Y SUM(Z) ---------- ---------- ---------- 1 4 110 2 3 84 10g Something changes and now you get SQL> SELECT x, y, sum(z) FROM t GROUP BY x, y; X Y SUM(Z) ---------- ---------- ---------- 2 3 84 1 4 110
  • 10. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_ADVANCED_REWRITE 10 Fixing the unfixable SQL statement Step 1 • Check what changed with the execution plan ORIGINIAL PLAN ----------------------------------- | Id | Operation | Name | ----------------------------------- | 0 | SELECT STATEMENT | | | 1 | HASH GROUP BY | | | 2 | TABLE ACCESS FULL| T | ----------------------------------- NEW PLAN -------------------------------------- | Id | Operation | Name | -------------------------------------- | 0 | SELECT STATEMENT | | | 1 | SORT GROUP BY NOSORT| | | 2 | INDEX FULL SCAN |T_IDX | --------------------------------------
  • 11. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_ADVANCED_REWRITE 11 Fixing the unfixable SQL statement Step 2 • Check the order of the columns in the index SQL> SELECT column_position, column_name FROM user_ind_columns WHERE index_name='T_IDX' ORDER BY column_position; COLUMN_POSITION COLUMN --------------- ------ 1 Y 2 X 3 Z • New index returns the rows in a different order because its sorted on column Y rather than X
  • 12. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_ADVANCED_REWRITE 12 Fixing the unfixable SQL statement Step 3 • Create a view v that includes an order by clause so the query results will always be order based on the values column x SQL> CREATE OR REPLACE VIEW v 2 AS 3 SELECT x, y, sum(z) "SUM(Z)" 4 FROM t 5 GROUP BY x, y 6 ORDER BY x, y; View created.
  • 13. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_ADVANCED_REWRITE 13 Fixing the unfixable SQL statement Step 4 • Use the DBMS_ADVANCED_REWRITE procedure to map the original query to a simple SELECT * FROM v; SQL> BEGIN 2 sys.dbms_advanced_rewrite.declare_rewrite_equivalence( 3 name => 'DEMO_TIME', 4 source_stmt => 'SELECT x, y, sum(z) FROM t GROUP BY x, y', 5 destination_stmt => 'SELECT * FROM v', 6 validate => FALSE, 7 rewrite_mode => 'TEXT_MATCH'); 8 END; 9 / PL/SQL procedure successfully completed.
  • 14. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_ADVANCED_REWRITE 14 Fixing the unfixable SQL statement • Each time our original SQL statement is issued the DBMS_ADVANCED_REWRITE procedure rewrites it to be SELECT * FROM v; • Always get the query output in an order list SQL> SELECT x, y, sum(z) FROM t GROUP BY x, y; X Y SUM(Z) ---------- ---------- ---------- 1 4 110 2 3 84 ----------------------------------- | Id | Operation | Name | ----------------------------------- | 0 | SELECT STATEMENT | | | 1 | VIEW | V | | 2 | SORT GROUP BY | | | 3 | INDEX FULL SCAN|T_IDX | -----------------------------------
  • 15. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_COMPARISON • Trying to figure out why things behave differently in production then they do in test can be time consuming and painful • The DBMS_COMPARISON package allows you to compare objects, schemas or data between databases or schemas • For a table comparison you do need a unique index on both tables • Begin by creating the comparison 15 Figuring out why production is different to test SQL> BEGIN DBMS_COMPARISON.CREATE_COMPARISON ( comparison_name => 'COMP_SALES', schema_name => 'SH', object_name => 'SALES', dblink_name => 'orcl2_test' ); END; / 11g
  • 16. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_COMPARISON • Execute the COMPARE function to perform the compare operation • Returns a boolean to say if there is or is not consistency • The scan_id allows you to find out what the differences are 16 SQL> DECLARE scan_info DBMS_COMPARISON.COMPARISON_TYPE; BEGIN IF NOT DBMS_COMPARISON.COMPARE ( comparison_name => 'COMP_SALES' , scan_info => scan_info , perform_row_dif => TRUE ) THEN DBMS_OUTPUT.PUT_LINE('Scan ID:'|| scan_info.scan_id); END IF; END; / Scan ID: 1
  • 17. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | DBMS_COMPARISON 17 SELECT c.COLUMN_NAME, r.INDEX_VALUE, case when r.LOCAL_ROWID is null then ‘No’ else 'Yes’ end LOCAL, Case when r.REMOTE_ROWID is null then 'No’ else 'Yes’ end REMOTE FROM USER_COMPARISON_COLUMNS c, USER_COMPARISON_ROW_DIF r, USER_COMPARISON_SCAN s WHERE c.COMPARISON_NAME = 'COMP_SALES‘ AND c.INDEX_COLUMN = 'Y’ AND r.STATUS = 'DIF’ AND c.COMPARISON_NAME = r.COMPARISON_NAME AND r.SCAN_ID = s.SCAN_ID AND s.SCAN_ID = 1 ORDER BY r.INDEX_VALUE; COLUMN_NAME INDEX_VALUE LOCAL REMOTE ----------- ----------- ----- ------ TAX_CODE 0.05 No Yes Test environment has an different tax code
  • 18. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Many More Powerful Supplied PL/SQL Packages • Oracle Database 18c provides 300 PL/SQL packages • Some of my favorites include: – DBMS_STATS – DBMS_SHARED_POOL – DBMS_SPM – DBMS_AUTO_TASK_ADMIN – DBMS_SQLTUNE • Check out more details in the PL/SQL Packages and Types Reference 18

Editor's Notes

  1. Oracle Database 8i had only 60 pl/sql packages while 18c has 300!
  2. Oracle Database 8i only 60 PL/SQL packages