dmann-sqldeveloper4reporting

58
David Mann - Biogen Idec - ECOUG 2014 Getting the Most Out of SQL Developer User-Defined Reports

Upload: david-mann

Post on 14-Apr-2017

182 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: DMann-SQLDeveloper4Reporting

David Mann - Biogen Idec - ECOUG 2014

Getting the Most Out of SQL Developer User-Defined Reports

Page 2: DMann-SQLDeveloper4Reporting

Topics• Context

• Why use SQL Developer for reports?

• Canned Report Review

• Basic User Defined Reports

• Supplying Parameters to Reports

• Parent/Child & Drill Down

• Advanced - Charts, HTML, Command Line Reports

• Where do you go from here?

Page 3: DMann-SQLDeveloper4Reporting

Bio

• Graphic Arts Background

• Development Background

• Lead Oracle DBA @

• Interests :

• Tools, Performance, Data Visualization

Page 4: DMann-SQLDeveloper4Reporting

Context• GUI Java Application

• Available for Windows/Mac OS X/Linux

• Free from Oracle

• Connects to databases via JDBC

• No OCI client required (usually)

• TNS / LDAP / Custom connection parameters

Page 5: DMann-SQLDeveloper4Reporting

Why use SQL Developer for reports?

Page 6: DMann-SQLDeveloper4Reporting

Ease of Use• Ready to go infrastructure

• Multiple OSes supported

• Quick download and install

• Just need a JVM + GUI

Page 7: DMann-SQLDeveloper4Reporting

Features• Feature Rich Admin and Query Tool

• Source Code Control Integration • Unit testing • Data Modeling • DBA Module

• Vote for features • Its a democracy, get some you want, some

you don’t • Access to expertise

Page 8: DMann-SQLDeveloper4Reporting

Reporting• Robust reporting feature set

• Canned reports • User Defined Reports • HTML/PDF Output Options • Command Line Report Generation

• Extensible • Customizable / Extensions

• Portable report definitions • Sharing is caring

Page 9: DMann-SQLDeveloper4Reporting

4.0 - Not Your Father’s SQL Developer• Faster report development round trips

• Live Preview in report editor during design time

• 50+ Charting Options

• Live preview also available for charts

• Comprehensive reports included out of the box

• Command Line Report Generation

Page 10: DMann-SQLDeveloper4Reporting
Page 11: DMann-SQLDeveloper4Reporting

Personal Reporting Process• DBA 1.0? • Get out of the query-> export ->

Excel Graph rut • Too cumbersome to repeat reliably • Slow to repeat • Hard to share with others • Hard to motivate others to use your methods

• Put this power into user’s hands with UDRs

Page 12: DMann-SQLDeveloper4Reporting

Canned Reports

Page 13: DMann-SQLDeveloper4Reporting

Canned Reports• Lots of useful reports included

• Database Administration

• Data Dictionary

• Object Info

• Application Express

• Performance

• + more

Page 14: DMann-SQLDeveloper4Reporting

Other Canned Report Uses• Good learning tool

• Copy + Modify

• Can be the target of your own Drill Down reports

Page 15: DMann-SQLDeveloper4Reporting

Basic User Defined Reports

Page 16: DMann-SQLDeveloper4Reporting

Create a Simple UDR

Page 17: DMann-SQLDeveloper4Reporting

Specify Properties

Page 18: DMann-SQLDeveloper4Reporting

Set SQL Query

Page 19: DMann-SQLDeveloper4Reporting

Run It

Page 20: DMann-SQLDeveloper4Reporting

Gauge Example

Page 21: DMann-SQLDeveloper4Reporting

Building Gauges• SQLDEV:GAUGE • min:max:low thresh:upper threshold:value

Page 22: DMann-SQLDeveloper4Reporting

Using Bind Variables

Page 23: DMann-SQLDeveloper4Reporting

Filter with Binds

Page 24: DMann-SQLDeveloper4Reporting

Bind Variable Details

Page 25: DMann-SQLDeveloper4Reporting

“All” Option• Provide for optional use of Bind Variables

Page 26: DMann-SQLDeveloper4Reporting

Parent/Child Reports

Page 27: DMann-SQLDeveloper4Reporting

• Consist of a pair of related queries

• Child query refreshed when Parent row clicked

• Related by bind variable

Page 28: DMann-SQLDeveloper4Reporting

Parent/Child

Page 29: DMann-SQLDeveloper4Reporting

Drill Down Reports

Page 30: DMann-SQLDeveloper4Reporting

Features• Like Parent/Child but Child is hidden

• Multiple Children can be attached to each Parent

• Usage

• Right click on Parent data element

• Select drill down report name

• Helps navigate your data

Page 31: DMann-SQLDeveloper4Reporting

Creation• Create target report • Add to parent report* • Drilled report has access to bind variables

Page 32: DMann-SQLDeveloper4Reporting

Navigation

Forward:

Back:

Page 33: DMann-SQLDeveloper4Reporting

Advanced : Charts

Page 34: DMann-SQLDeveloper4Reporting

Charts

Page 35: DMann-SQLDeveloper4Reporting

Charts• Prepare data series

• Position 1 : Category Group (Y Axis)

• Position 2 : Series (Legend)

• Position 3 : Data Value (X Axis)

• Choose best representation

• Customize styles

• Test it!

Page 36: DMann-SQLDeveloper4Reporting

Chart Usage• Combine Parent Summary chart with Child

Detail report

• Can click on chart region to generate child report

• Best of both worlds - digest the summary but have access to detail

Page 37: DMann-SQLDeveloper4Reporting

Save as HTML

Page 38: DMann-SQLDeveloper4Reporting

Options

Page 39: DMann-SQLDeveloper4Reporting

Table Report as HTML

Page 40: DMann-SQLDeveloper4Reporting

Chart Rendered in SQL Dev

Page 41: DMann-SQLDeveloper4Reporting

Chart as HTML

Page 42: DMann-SQLDeveloper4Reporting

Advanced : Internal HTML Render

&PL/SQL DBMS_OUTPUT

Page 43: DMann-SQLDeveloper4Reporting

HTML - Internal Render

• PL/SQL DBMS_OUTPUT or Table Cell

• Supports HTML subset

• Supports inline CSS

• No:

• Style sheets

• Javascript

Page 44: DMann-SQLDeveloper4Reporting

HTML Example 1

Source Code

Page 45: DMann-SQLDeveloper4Reporting

HTML Example 2

Source Code

Page 46: DMann-SQLDeveloper4Reporting

HTML Example 3

Source Code

Page 47: DMann-SQLDeveloper4Reporting

HTML Example 4

Source Code

Page 48: DMann-SQLDeveloper4Reporting

Advanced: HTML External Render

PL/SQL DBMS_OUTPUT

Page 49: DMann-SQLDeveloper4Reporting

HTML - External Render• Many report types will save to local

HTML file

• Formatting decisions made for you

• Not all features may translate

Page 50: DMann-SQLDeveloper4Reporting

Advanced: Command Line Interface

Page 51: DMann-SQLDeveloper4Reporting

• Develop in SQL Developer, call from Command Line

• Leverages SQL Developer connection info

• Can supply Bind variables

• Con: Heavyweight JVM Startup

Command Line

./sdcli reports generate \ -report "User Defined Reports/My Report" \ -db "PDB1 - dmann" \ -file /tmp/test.html \ -bind name=value

Page 52: DMann-SQLDeveloper4Reporting

Putting It All Together• Let’s make the most complicated UDF we can

• HTML Report

• External render

• Javascript referencing external libraries

• Kick it off via the command line

• Look at familiar data in a new way

Page 53: DMann-SQLDeveloper4Reporting

Example Output

Source Code

Page 54: DMann-SQLDeveloper4Reporting

Behind the Scenes• Check the XML

• Do you feel lucky?

Page 55: DMann-SQLDeveloper4Reporting

Where Do You Go From Here?• Start your own collection of UD Reports

• SQL Analytic Features

• Custom Actions

• What can you automate?

• SQL Developer Exchange, OTN

• http://github.com/dmann99/SQLDevUDRepPack

• “5 in 5” at http://ba6.us

Page 56: DMann-SQLDeveloper4Reporting

Questions

Slides, code, links :

http://ba6.us

[email protected]

@ba6dotus

http://github.com/dmann99

Page 57: DMann-SQLDeveloper4Reporting

References• http://www.thatjeffsmith.com/archive/2014/04/

how-to-add-custom-actions-to-your-user-reports/

• http://www.thatjeffsmith.com/archive/2012/07/customizing-monitor-sessions-in-oracle-sql-developer/

Page 58: DMann-SQLDeveloper4Reporting

Abstract• SQL Developer has proved itself as one of the

most innovative and useful tools available for Oracle users, DBAs, and developers. With the release of version 4.0 the included and custom report options have been greatly expanded. This session will review the different types of reports available in SQL developer and review the powerful Custom Reports features. Demos will include creating simple and complex user defined reports, leveraging the new graph types, as well as a discussion and demo of the new command line HTML reports generation features.