Plsql+tips+n+tricks+2011

Post on 11-May-2015

3,674 views 1 download

Tags:

description

Toad empowers the PL/SQL professional. Get more out of Toad!

transcript

© 2009 Quest Software, Inc. ALL RIGHTS RESERVED

Toad Tips & Tricks for the PL/SQL Pro

Tips & Tricks for the PL/SQL Professional

Toad® for Oracle

2

Editor 201

• Code Insight– Object name completion (CNTRL + Period)– Column Popup (Multi-Select!)– PL/SQL Completion

– Too ‘Mr. Clippy’ for yourtastes? Disable thefeature!

VS

3

Editor 201• SQL Recall

– Use Named SQL for super fast recall.– ALT + Up/Dn to scroll through history recall list

• Code Snippets– If..Then..Elsif..– Exceptions– Cursor For Loop– Your custom code

4

Split Editor

• Work with multiple sections of your file simultaneously– Left/Right– Top/Bottom

5

Editor 201• Make/Strip Code

– Translate Delphi, Java, C++, Perl, C#, VB, etc to SQL– Translate SQL to Delphi, Java, …– Write your own custom Code Transformation Templates

6

Editor 201

• Keyboard Shortcuts– Check your options!

• Customize Toolbars– Hate Toad’s 80 gazillion

buttons and toolbars? TURN THEM OFF

7

Editor 201• Debugger

– Conditional Breakpoints– Use Watches to change variable values and as breakpoints– Step into TYPE Body– Supports DML Triggers– Toad can now write your DBMS_OUTPUT instrumentation code for you!

8

External Debugging• Debug a session that is spawned from a remote

application or service.• Step thorough your code and view the data as it was

initialized somewhere else in the world.

• Your application’s session sets a DEBUG Flag with a named Identifier

• You tell Toad which session to grab. Toad automatically steps into the code.

9

Editor 201• Never build a DBMS_OUTPUT statement manually !

– Right-click – Output Statements• Find a matching END IF, END or ) using bracketing• Code Folding• Code Refactoring

10

Code Road Map – Document and Create Local Test/Development Environments – 1 Click!

• Diagram Views & PL/SQL Objects– Generate Test Data– Generate DDL Scripts– Build HTML Reports

11

PL/SQL Profiler (DBMS_ & Hierarchical Support)

• Find out which lines take longer to run than others.• Identify execution bottlenecks• Figure out what needs tuning

Integrated with the Editor for instant analysis.

Graphs for quicker identification.

12

PL/SQL Execution – View Collections• Return Values & Out Parameters for your PL/SQL – let Toad

build DMBS_OUPUT for you• Example – A 2 Dimensional PL/SQL Table Package Function

that returns a PL/SQL Table.

13

PL/SQL Execution – View REF Cursors• Does your PL/SQL return a REF Cursor? Let Toad put it

into a Data Grid for you.

14

3rd Party Source Code Control Integration

• CVS• MSFT TFS 2005, 2008, 2010• MSFT Visual Source Safe• Perforce• PVCS (Serena)• Subversion

Control files or additionally control objects in the database via Toad’s Team Coding Feature

15

CodeXpert – let Toad review your code before your peers laugh at you

• Analyzes your code against Best Practices rules developed by Steven Feuerstein, Bert Scalzo, and Quest’s Oracle experts.

Explains why your code is flagged and

gives advice for better implementations.

Can identify SQL that needs Optimized.

16

Ok, you’ve written some kick-butt PL/SQL, but does it work?• Quest’s latest PL/SQL tool automatically tests your

PL/SQL for correctness.

Step 1: Tell Code Tester what your program does in PLAIN ENGLISH

17

Code Tester for Oracle Writes the Test Code For You!

Step 2: Sit back and relax as Code Tester generates your test code.

18

Run your tests on demand to see what your programs DO and DO NOT accomplish.

Step 3: Analyze the results. RED = BAD. See the Expected VS Actual Results.

19

Test Performance/Scalability

• Your stored procedure runs OK for 1 user, how will it handle 10? 50? 100?

• Toad can answer that question, track response time to user load

© 2009 Quest Software, Inc. ALL RIGHTS RESERVED

Thank youThank you Questions?you