SQL Developer
SQL Developer
SQL Developer
User’s Guide
Release 2.1
E15222-02
February 2010
Provides conceptual and usage information about Oracle
SQL Developer, a graphical tool that enables you to browse,
create, edit, and delete (drop) database objects; run SQL
statements and scripts; edit and debug PL/SQL code;
manipulate and export data; migrate third-party databases to
Oracle; view metadata and data in third-party databases; and
view and create reports.
Oracle SQL Developer User's Guide, Release 2.1
E15222-02
Copyright © 2006, 2010, Oracle and/or its affiliates. All rights reserved.
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this software or related documentation is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data
delivered to U.S. Government customers are "commercial computer software" or "commercial technical data"
pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As
such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and
license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of
the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software
License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software is developed for general use in a variety of information management applications. It is not
developed or intended for use in any inherently dangerous applications, including applications which may
create a risk of personal injury. If you use this software in dangerous applications, then you shall be
responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use
of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of
this software in dangerous applications.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks
of their respective owners.
This software and documentation may provide access to or information on content, products, and services
from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all
warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and
its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of
third-party content, products, or services.
Contents
Preface ............................................................................................................................................................... xv
Audience..................................................................................................................................................... xv
Documentation Accessibility ................................................................................................................... xv
Product Accessibility ................................................................................................................................ xvi
Related Documents ................................................................................................................................... xvi
Conventions ............................................................................................................................................... xvi
Third-Party License Information............................................................................................................. xvi
iii
1.3.21 Triggers .............................................................................................................................. 1-18
1.3.22 Types................................................................................................................................... 1-18
1.3.23 Users (Other Users) .......................................................................................................... 1-18
1.3.24 Views .................................................................................................................................. 1-18
1.3.25 XML DB Repository.......................................................................................................... 1-18
1.3.26 XML Schemas .................................................................................................................... 1-19
1.3.27 Captured and Converted Database Objects (for Migration) ...................................... 1-19
1.4 Database Connections ............................................................................................................. 1-19
1.4.1 Using Folders to Group Connections ............................................................................ 1-21
1.4.2 Sharing of Connections .................................................................................................... 1-22
1.4.3 Advanced Security for JDBC Connection to the Database ......................................... 1-22
1.4.4 Connections with Operating System (OS) Authentication......................................... 1-22
1.4.5 Connections with Proxy Authentication ....................................................................... 1-22
1.5 Entering and Modifying Data ................................................................................................ 1-23
1.6 Running and Debugging Functions and Procedures ......................................................... 1-25
1.6.1 Using Bookmarks When Editing Functions and Procedures ..................................... 1-27
1.6.2 Remote Debugging ........................................................................................................... 1-27
1.6.3 Displaying SQL Trace (.trc) Files .................................................................................... 1-27
1.6.4 Using the PL/SQL Hierarchical Profiler ....................................................................... 1-28
1.6.5 Setting Expression Watches ............................................................................................ 1-28
1.7 Using the SQL Worksheet....................................................................................................... 1-28
1.7.1 SQL*Plus Statements Supported and Not Supported in SQL Worksheet................ 1-31
1.7.2 Script Runner..................................................................................................................... 1-32
1.7.3 Execution Plan................................................................................................................... 1-33
1.7.4 Autotrace Pane .................................................................................................................. 1-33
1.7.5 DBMS Output Pane .......................................................................................................... 1-33
1.7.6 OWA Output Pane ........................................................................................................... 1-34
1.7.7 SQL History ....................................................................................................................... 1-34
1.7.8 Gauges: In the SQL Worksheet and User-Defined Reports........................................ 1-35
1.8 Using Snippets to Insert Code Fragments............................................................................ 1-36
1.8.1 User-Defined Snippets ..................................................................................................... 1-36
1.9 Finding Database Objects ....................................................................................................... 1-37
1.10 Using Versioning ..................................................................................................................... 1-37
1.10.1 About CVS and SQL Developer ..................................................................................... 1-38
1.10.1.1 Pending Changes (CVS) ........................................................................................... 1-38
1.10.2 About Subversion and SQL Developer ......................................................................... 1-38
1.11 SQL Developer Reports........................................................................................................... 1-39
1.11.1 About Your Database reports ......................................................................................... 1-40
1.11.2 All Objects reports ............................................................................................................ 1-40
1.11.3 Application Express reports............................................................................................ 1-41
1.11.4 ASH and AWR reports..................................................................................................... 1-41
1.11.5 Charts reports.................................................................................................................... 1-41
1.11.6 Database Administration reports ................................................................................... 1-41
1.11.7 Data Dictionary reports ................................................................................................... 1-42
1.11.8 Jobs reports ........................................................................................................................ 1-42
1.11.9 PL/SQL reports................................................................................................................. 1-42
1.11.10 Security reports ................................................................................................................. 1-43
iv
1.11.11 Streams reports ................................................................................................................. 1-43
1.11.12 Table reports...................................................................................................................... 1-43
1.11.13 XML reports....................................................................................................................... 1-45
1.11.14 Migration reports.............................................................................................................. 1-45
1.11.15 User Defined reports ........................................................................................................ 1-45
1.11.15.1 User-Defined Report Example: Chart..................................................................... 1-46
1.11.15.2 User-Defined Report Example: Dynamic HTML.................................................. 1-47
1.12 SQL Developer Preferences .................................................................................................... 1-48
1.12.1 Environment ...................................................................................................................... 1-48
1.12.2 Code Editor........................................................................................................................ 1-49
1.12.3 Compare and Merge......................................................................................................... 1-51
1.12.4 Database ............................................................................................................................. 1-52
1.12.5 Debugger............................................................................................................................ 1-57
1.12.6 Extensions .......................................................................................................................... 1-58
1.12.7 External Editor .................................................................................................................. 1-58
1.12.8 File Types ........................................................................................................................... 1-58
1.12.9 Global Ignore List ............................................................................................................. 1-59
1.12.10 Migration............................................................................................................................ 1-59
1.12.11 Mouseover Popups........................................................................................................... 1-62
1.12.12 Shortcut Keys (Accelerator Keys)................................................................................... 1-62
1.12.13 Unit Test Parameters ........................................................................................................ 1-63
1.12.14 Versioning.......................................................................................................................... 1-63
1.12.15 Web Browser and Proxy .................................................................................................. 1-66
1.13 Location of User-Related Information .................................................................................. 1-66
1.14 Data Modeler Viewer (Read-Only) ....................................................................................... 1-67
1.15 Oracle TimesTen In-Memory Database Support................................................................. 1-67
1.16 Using the Help.......................................................................................................................... 1-68
1.17 Tip of the Day ........................................................................................................................... 1-68
1.17.1 SQL History Shortcuts ..................................................................................................... 1-68
1.17.2 Unshared Worksheets ...................................................................................................... 1-69
1.17.3 SQL Worksheet Bookmarks ............................................................................................ 1-69
1.17.4 Formatted Display of SQL Trace (.trc) Files.................................................................. 1-69
1.17.5 Folders for Organizing Connections.............................................................................. 1-69
1.17.6 Third-Party Databases and SQL Developer.................................................................. 1-69
1.17.7 Debugger Ports and Firewalls ........................................................................................ 1-69
1.17.8 Viewing Multiple Tables ................................................................................................. 1-69
1.17.9 Customizing SQL Developer Appearance.................................................................... 1-69
1.17.10 Maximizing Tab Panes..................................................................................................... 1-69
1.17.11 Default Path for Running Scripts ................................................................................... 1-70
1.17.12 Shutting Down and Restarting the Database ............................................................... 1-70
1.17.13 Feature Requests ............................................................................................................... 1-70
1.17.14 Discussion Forum ............................................................................................................. 1-70
1.17.15 Help Text Font Size .......................................................................................................... 1-70
1.17.16 Procedure and Function Signatures............................................................................... 1-70
1.17.17 Type-Ahead in Navigators .............................................................................................. 1-70
1.17.18 Extended Paste .................................................................................................................. 1-71
1.17.19 Closing Tabbed Windows Using the Mouse Wheel .................................................... 1-71
v
1.17.20 Go to Last Edit Location .................................................................................................. 1-71
1.17.21 Closing Tabbed Windows Using the Context Menu................................................... 1-71
1.17.22 List of All Open Windows............................................................................................... 1-71
1.17.23 Go to Subprogram Implementation from Package Window ..................................... 1-71
1.17.24 Select Multiple Table or Column Names in Completion Insight .............................. 1-71
1.18 For More Information.............................................................................................................. 1-71
vi
2.11.2.1 Guidelines for Creating Tests .................................................................................. 2-28
2.11.2.2 Example of a Unit Test Case .................................................................................... 2-28
2.12 Deploying the Oracle Database ............................................................................................. 2-29
2.12.1 Choosing a Rollout Strategy............................................................................................ 2-29
2.12.1.1 Phased Approach ...................................................................................................... 2-29
2.12.1.2 Big Bang Approach ................................................................................................... 2-30
2.12.1.3 Parallel Approach...................................................................................................... 2-30
2.12.2 Deploying the Destination Database ............................................................................. 2-30
2.13 Using Migration Reports ........................................................................................................ 2-31
2.14 SQL Developer User Interface for Migration....................................................................... 2-31
2.14.1 Migration Menu ................................................................................................................ 2-33
2.14.2 Other Menus: Migration Items ....................................................................................... 2-33
2.14.3 Migration Preferences ...................................................................................................... 2-33
2.14.4 Migration Log Panes ........................................................................................................ 2-34
2.14.5 Using the Translation Scratch Editor ............................................................................. 2-34
vii
4.2 Create a Table (PATRONS) ....................................................................................................... 4-3
4.3 Create a Table (TRANSACTIONS)........................................................................................... 4-4
4.4 Create a Sequence ....................................................................................................................... 4-6
4.5 Insert Data into the Tables ......................................................................................................... 4-7
4.6 Create a View............................................................................................................................... 4-8
4.7 Create a PL/SQL Procedure...................................................................................................... 4-8
4.8 Debug a PL/SQL Procedure ..................................................................................................... 4-9
4.9 Use the SQL Worksheet for Queries ..................................................................................... 4-11
4.10 Script for Creating and Using the Library Tutorial Objects .............................................. 4-12
viii
5.37 Storage Options ........................................................................................................................ 5-27
5.38 Create Trigger........................................................................................................................... 5-28
5.39 Create Type (User-Defined) ................................................................................................... 5-30
5.40 Create/Edit User...................................................................................................................... 5-30
5.41 Create/Edit User Defined Report.......................................................................................... 5-31
5.42 Create/Edit User Defined Report Folder ............................................................................. 5-32
5.43 Create/Edit View..................................................................................................................... 5-32
5.44 Create XML Schema ................................................................................................................ 5-38
5.45 Configure Extension ................................................................................................................ 5-38
5.46 Configure File Type Associations.......................................................................................... 5-38
5.47 Copy Columns.......................................................................................................................... 5-39
5.48 Custom Filters .......................................................................................................................... 5-39
5.49 Database Copy (Schema Objects) .......................................................................................... 5-39
5.50 Database Schema Differences................................................................................................. 5-40
5.51 DDL Panel for Creating or Editing an Object ...................................................................... 5-41
5.52 Debugger - Attach to JPDA .................................................................................................... 5-41
5.53 Deploy or Import Application ............................................................................................... 5-41
5.54 Describe Object Window ........................................................................................................ 5-42
5.55 Edit/View Value (Table Column or Other Data)................................................................ 5-42
5.56 Enter Bind Values .................................................................................................................... 5-42
5.57 Erase from Disk ........................................................................................................................ 5-42
5.58 Error Writing to Export File ................................................................................................... 5-42
5.59 Export (Database Objects and Data) ..................................................................................... 5-43
5.60 Export: Advanced Data Filter ................................................................................................ 5-45
5.61 Export Error .............................................................................................................................. 5-45
5.62 Export Data ............................................................................................................................... 5-45
5.63 Export Table Data .................................................................................................................... 5-45
5.64 External Locator Configuration ............................................................................................. 5-46
5.65 External Tools ........................................................................................................................... 5-46
5.66 Create/Edit External Tool ...................................................................................................... 5-47
5.67 Choose Offline Options........................................................................................................... 5-48
5.68 Edit Join ..................................................................................................................................... 5-48
5.69 Feature Required...................................................................................................................... 5-48
5.70 Filter ........................................................................................................................................... 5-49
5.71 Insert Macro .............................................................................................................................. 5-49
5.72 Externally Modified Files........................................................................................................ 5-49
5.73 Filter Object Types ................................................................................................................... 5-49
5.74 Filter Schemas........................................................................................................................... 5-50
5.75 Filter Error................................................................................................................................. 5-50
5.76 Find/Replace Text ................................................................................................................... 5-50
5.77 Find Result ................................................................................................................................ 5-51
5.78 Format Properties .................................................................................................................... 5-51
5.79 Generate Oracle DDL .............................................................................................................. 5-51
5.80 Generate Offline Data Move Files ......................................................................................... 5-51
5.81 Generate Patch.......................................................................................................................... 5-51
5.82 Go to Bookmark ....................................................................................................................... 5-52
5.83 Go to Line Number .................................................................................................................. 5-52
ix
5.84 Go to Line Number: Error....................................................................................................... 5-52
5.85 Import to CVS........................................................................................................................... 5-52
5.86 Load Keyboard Scheme .......................................................................................................... 5-53
5.87 Log In to CVS............................................................................................................................ 5-53
5.88 Manage Columns ..................................................................................................................... 5-53
5.89 Modify Value ............................................................................................................................ 5-53
5.90 Data Move Details.................................................................................................................... 5-54
5.91 New Procedure (Refactoring)................................................................................................. 5-54
5.92 No Object Found ...................................................................................................................... 5-54
5.93 No Object Selected ................................................................................................................... 5-54
5.94 Object Preferences.................................................................................................................... 5-55
5.95 Open File ................................................................................................................................... 5-55
5.96 Oracle-Only Report.................................................................................................................. 5-55
5.97 Oracle Proxy Authentication.................................................................................................. 5-55
5.98 Paste ........................................................................................................................................... 5-55
5.99 Privilege Warning for Migration ........................................................................................... 5-55
5.100 Query Builder ........................................................................................................................... 5-56
5.101 Recent Files ............................................................................................................................... 5-56
5.102 Create Repository..................................................................................................................... 5-56
5.103 Delete or Truncate Repository ............................................................................................... 5-57
5.104 Capture Microsoft Access Exporter XML............................................................................. 5-57
5.105 Rename Local Variable............................................................................................................ 5-57
5.106 Rename Procedure................................................................................................................... 5-57
5.107 Select Current Repository ....................................................................................................... 5-57
5.108 Cannot Capture Table ............................................................................................................. 5-57
5.109 Reset Expired Password (Enter New Password) ................................................................ 5-58
5.110 Revision Lister .......................................................................................................................... 5-58
5.111 Run/Debug/Profile PL/SQL................................................................................................. 5-58
5.112 Create/Edit Breakpoint........................................................................................................... 5-59
5.113 Save/Save As, or Select File ................................................................................................... 5-59
5.114 Save Files ................................................................................................................................... 5-59
5.115 Unable to Save Files................................................................................................................. 5-60
5.116 Save Style Settings ................................................................................................................... 5-60
5.117 Schema Differences Source or Destination Error ................................................................ 5-60
5.118 Script Execution Failed............................................................................................................ 5-60
5.119 Script Generation Complete ................................................................................................... 5-60
5.120 Set Data Mapping .................................................................................................................... 5-60
5.121 Add/Edit Rule.......................................................................................................................... 5-61
5.122 Set Encoding ............................................................................................................................. 5-61
5.123 Set Pause Continue .................................................................................................................. 5-61
5.124 Sign In (checking for updates) ............................................................................................... 5-61
5.125 Single Record View.................................................................................................................. 5-62
5.126 Save Snippet (User-Defined) .................................................................................................. 5-62
5.127 Edit Snippets (User-Defined) ................................................................................................. 5-62
5.128 Subversion: Add Property ...................................................................................................... 5-62
5.129 Subversion: Add to Source Control....................................................................................... 5-62
5.130 Subversion: Apply Patch ........................................................................................................ 5-63
x
5.131 Subversion: Branch/Tag ......................................................................................................... 5-63
5.132 Subversion: Check Out from Subversion ............................................................................. 5-63
5.133 Subversion: Commit Resources ............................................................................................. 5-64
5.134 Subversion: Commit Working Copy..................................................................................... 5-64
5.135 Subversion: Confirm Checkout.............................................................................................. 5-64
5.136 Subversion: Create Remote Directory................................................................................... 5-64
5.137 Subversion: Create Subversion Repository .......................................................................... 5-65
5.138 Subversion: Create/Edit Subversion Connection ............................................................... 5-65
5.139 Subversion: Edit Configuration File...................................................................................... 5-65
5.140 Subversion: Export Files ......................................................................................................... 5-66
5.141 Subversion: Export Subversion Connections....................................................................... 5-66
5.142 Subversion: History ................................................................................................................. 5-66
5.143 Subversion: Ignore ................................................................................................................... 5-66
5.144 Subversion: Import Subversion Connections ...................................................................... 5-66
5.145 Subversion: Import to Subversion ......................................................................................... 5-66
5.146 Subversion: Lock Resources ................................................................................................... 5-67
5.147 Subversion: Merge ................................................................................................................... 5-67
5.148 Subversion: Pending Changes ............................................................................................... 5-68
5.149 Subversion: Properties ............................................................................................................ 5-69
5.150 Subversion: Remove from Subversion.................................................................................. 5-69
5.151 Subversion: Repository Browser............................................................................................ 5-69
5.152 Subversion: Revert Local Changes ........................................................................................ 5-69
5.153 Subversion: Switch................................................................................................................... 5-69
5.154 Subversion: Unlock Resources ............................................................................................... 5-70
5.155 Subversion: Update Resources............................................................................................... 5-70
5.156 Subversion: Update Working Copy ...................................................................................... 5-70
5.157 Subversion: Versioning Properties ........................................................................................ 5-70
5.158 Third-Party Database Objects ................................................................................................ 5-71
5.159 Unable to Connect.................................................................................................................... 5-71
5.160 Unable to Open File ................................................................................................................. 5-71
5.161 Unit Testing: Action Required ............................................................................................... 5-71
5.162 Unit Testing: Add Category ................................................................................................... 5-71
5.163 Unit Testing: Add Data Type ................................................................................................. 5-71
5.164 Unit Testing: Add Item to Library......................................................................................... 5-71
5.165 Unit Testing: Add Test Implementation............................................................................... 5-71
5.166 Unit Testing: Add Test Suite .................................................................................................. 5-72
5.167 Unit Testing: Add Tests to Suite ............................................................................................ 5-72
5.168 Unit Testing: Copy or Rename Unit Test ............................................................................. 5-72
5.169 Unit Testing: Create Unit Test................................................................................................ 5-72
5.170 Unit Testing: Manage Users ................................................................................................... 5-74
5.171 Unit Testing: Result of Operation.......................................................................................... 5-74
5.172 Unsupported Database Version............................................................................................. 5-74
5.173 Windows ................................................................................................................................... 5-74
xi
List of Figures
1–1 SQL Developer Main Window.................................................................................................. 1-3
2–1 SQL Developer Migration Architecture .................................................................................. 2-6
2–2 V-model with a Database Migration ..................................................................................... 2-26
2–3 Main Window for a Database Migration.............................................................................. 2-32
3–1 Unit Test Navigator .................................................................................................................... 3-3
xii
List of Tables
1–1 Default Locations for User-Related Information................................................................ 1-66
2–1 Complex and Simple Scenarios................................................................................................ 2-7
xiii
xiv
Preface
This guide provides conceptual and usage information about Oracle SQL Developer, a
graphical tool that enables you to browse, create, edit, and delete (drop) database
objects; run SQL statements and scripts; edit and debug PL/SQL code; manipulate and
export data; and view and create reports.
Audience
This guide is intended for those using the Oracle SQL Developer tool.
Documentation Accessibility
Our goal is to make Oracle products, services, and supporting documentation
accessible to all users, including users that are disabled. To that end, our
documentation includes features that make information available to users of assistive
technology. This documentation is available in HTML format, and contains markup to
facilitate access by the disabled community. Accessibility standards will continue to
evolve over time, and Oracle is actively engaged with other market-leading
technology vendors to address technical obstacles so that our documentation can be
accessible to all of our customers. For more information, visit the Oracle Accessibility
Program Web site at http://www.oracle.com/accessibility/.
xv
Product Accessibility
If you are using a screen reader (such as JAWS), SQL Developer must be running on
the same system as the screen reader.
For more information about using a screen reader and Java Access Bridge with SQL
Developer, see Oracle SQL Developer Installation Guide.
Related Documents
For information about installing Oracle SQL Developer, see the Oracle SQL Developer
Installation Guide.
Oracle error message documentation is only available in HTML. If you only have
access to the Oracle Documentation CD, you can browse the error messages by range.
Once you find the specific range, use your browser's "find in page" feature to locate the
specific message. When connected to the Internet, you can search for a specific error
message using the error message search feature of the Oracle online documentation.
To download free release notes, installation documentation, white papers, or other
collateral, go to the Oracle Technology Network (OTN). You must register online
before using OTN; registration is free and can be done at
http://www.oracle.com/technology/membership
If you already have a user name and password for OTN, then you can go directly to
the documentation section of the OTN Web site at
http://www.oracle.com/technology/documentation
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for
which you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs, code
in examples, text that appears on the screen, or text that you enter.
xvi
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
Antlr v 2.7.3
http://www.antlr.org/rights.html
OracleAS TopLink uses Antlr for EJB QL parsing. Antlr (ANother Tool for Language
Recognition), is a language tool that provides a framework for constructing
recognizers, compilers, and translators from grammatical descriptions containing C++
or Java actions. The ANTLR parser and translator generator is fully in the public
domain.
xvii
■ Redistributions in any form must be accompanied by information on how to
obtain complete source code for the software that uses SVNKit and any
accompanying software that uses the software that uses SVNKit. The source code
must either be included in the distribution or be available for no more than the
cost of distribution plus a nominal fee, and must be freely redistributable under
reasonable conditions. For an executable file, complete source code means the
source code for all modules it contains. It does not include source code for
modules or files that typically accompany the major components of the operating
system on which the executable file runs.
■ Redistribution in any form without redistributing source code for software that
uses SVNKit is possible only when such redistribution is explicitly permitted by
TMate Software. Please, contact TMate Software at [email protected] to get
such permission.
THIS SOFTWARE IS PROVIDED BY TMATE SOFTWARE ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED.
IN NO EVENT SHALL TMATE SOFTWARE BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
xviii
1
1 SQL Developer Concepts and Usage
Note: This text explains the default interface. However, you can
customize many aspects of the appearance and behavior of SQL
Developer by setting preferences (see Section 1.12). If you ever need to
restore the default interface, see Section 1.2.2, "Restoring the Original
"Look and Feel"".
The menus at the top contain standard entries, plus entries for features specific to SQL
Developer (see Section 1.2.1, "Menus for SQL Developer"), as shown in the following
figure.
You can use shortcut keys to access menus and menu items: for example Alt+F for the
File menu and Alt+E for the Edit menu; or Alt+H, then Alt+S for Help, then Search.
You can also display the File menu by pressing the F10 key (except in the SQL
Worksheet, where F10 is the shortcut for Explain Plan).
Icons under the menus perform various actions, including the following:
■ New creates a new a new database object (see Section 5.11, "Create New Object").
■ Open opens a file (see Section 5.95, "Open File").
■ Save saves any changes to the currently selected object.
■ Save All saves any changes to all open objects.
■ Back moves to the pane that you most recently visited. (Or use the drop-down
arrow to specify a tab view.)
■ Forward moves to the pane after the current one in the list of visited panes. (Or
use the drop-down arrow to specify a tab view.)
■ Open SQL Worksheet opens the SQL Worksheet (see Using the SQL Worksheet).
If you do not use the drop-down arrow to specify the database connection to use,
you are asked to select a connection.
The left side of the SQL Developer window has tabs and panes for the Connections
and Reports navigators, icons for performing actions, and a hierarchical tree display
for the currently selected navigator, as shown in the following figure.
The Connections navigator lists database connections that have been created. To
create a new database connection, import an XML file with connection definitions, or
export or edit current connections, right-click the Connections node and select the
appropriate menu item. (For more information, see Section 1.4, "Database
Connections".)
The Files navigator (marked by a folder icon; not shown in the preceding figure)
displays your local file system using a standard hierarchy of folders and files. You can
double-click or drag and drop files to open them, and you can edit and save the files.
For example, if you open a .sql file, it is displayed in a SQL Worksheet window. The
Files navigator is especially useful if you are using versioning with SQL Developer
(see Section 1.10, "Using Versioning").
The Reports navigator lists informative reports provided by SQL Developer, such as a
list of tables without primary keys for each database connection, as well as any
user-defined reports. (For more information, see Section 1.11, "SQL Developer
Reports".)
Icons under the Connections tab (above the metadata tree) perform the following
actions on the currently selected object:
■ Refresh queries the database for the current details about the selected object (for
example, a connection or just a table).
■ Apply Filter restricts the display of objects using a filter that you specify. For
example, you can right-click the Tables node and specify a filter of EM% to see
only tables that start with EM and to have the Tables node label be changed to
Tables (EM%). To remove the effects of applying a filter, right-click the node and
select Clear Filter.
The metadata tree in the Connections pane displays all the objects (categorized by
object type) accessible to the defined connections. To select an object, expand the
appropriate tree node or nodes, then click the object.
The right side of the SQL Developer window has tabs and panes for objects that you
select or open, as shown in the following figure, which displays information about a
table named BOOKS. (If you hold the mouse pointer over the tab label -- BOOKS in
this figure -- a tooltip displays the object’s owner and the database connection.)
For objects other than subprograms, icons provide the following options:
■ Freeze View (the pin) keeps that object’s tab and information in the window when
you click another object in the Connections navigator; a separate tab and display
are created for that other object. If you click the pin again, the object’s display is
available for reuse.
■ Edit displays a dialog box for editing the object.
■ Refresh updates the display by querying the database for the latest information.
■ Actions displays a menu with actions appropriate for the object. The actions are
the same as when you right-click an object of that type in the Connections
navigator, except the Actions menu does not include Edit.
To switch among objects, click the desired tabs; to close a tab, click the X in the tab. If
you make changes to an object and click the X, you are asked if you want to save the
changes.
For tables and views, this information is grouped under tabs, which are labeled near
the top. For example, for tables the tabs are Columns, Data (for seeing and modifying
the data itself), Indexes, Constraints, and so on; and you can click a column heading
under a tab to sort the grid rows by the values in that column. For most objects, the
tabs include SQL, which displays the SQL statement for creating the object.
You can export data from a detail pane or from the results of a SQL Worksheet
operation or a report by using the context menu and selecting Export.
The Messages - Log area is used for feedback information as appropriate (for example,
results of an action, or error or warning messages). If this area is not already visible,
you can display is by clicking View and then Log.
The Compiler - Log area is used for any messages displayed as a result of a Compile
or Compile for Debug operation.
Edit menu
Extended Paste: Displays the Paste dialog box, in which you select a clipboard item
(from potentially many) to be pasted into the current location.
Duplicate Selection: When you have selected text while editing a function or
procedure, creates a copy of the selected text at the current location.
Wrap Selection: When you have selected text while editing a function or procedure,
wraps the selected text.
View menu
Contains options that affect what is displayed in the SQL Developer interface.
Breakpoints: Displays the Breakpoints pane, which shows breakpoints, both
system-defined and user-defined (see Section 1.6, "Running and Debugging Functions
and Procedures").
Debugger: Displays panes related to debugging (see Section 1.6, "Running and
Debugging Functions and Procedures").
Log: Displays the Messages - Log pane, which can contain errors, warnings, and
informational messages.
Run Manager: Displays the Run Manager pane, which contains entries for any active
debugging sessions.
Team: Lets you display the Versioning navigator (see Section 1.10, "Using Versioning").
Connections: Displays the Connections navigator.
Data Modeler: Lets you display the Browser and Thumbnail Diagram panes of the
Data Modeler Viewer (Read-Only).
Files: Displays the Files navigator, which is marked by a folder icon. You can use the
Files navigator to browse, open, edit, and save files that are accessible from the local
system.
Find DB Object: Displays the Find Database Object pane (see Section 1.9, "Finding
Database Objects").
History: Displays information about SQL statements that you have executed. You can
select statements and append them to or overwrite statements on the worksheet (see
Section 1.7.7, "SQL History").
Migrations: Lets you display the Captured Models and Converted Models navigators
(see Section 2.14, "SQL Developer User Interface for Migration").
OWA Output: Displays Oracle Web Agent (MOD_PLSQL) output (see Section 1.7.6,
"OWA Output Pane").
Recent Objects: Displays a pane with names of recently opened objects. You can click
a name in the list to go to its editing window.
Reports: Displays the Reports navigator (see Section 1.11, "SQL Developer Reports").
Snippets: Displays snippets (see Section 1.8, "Using Snippets to Insert Code
Fragments").
Task Progress: Displays the Task Progress pane.
Show Status Bar: Controls the display of the status bar at the bottom of the SQL
Developer window.
Show Toolbars: Controls the display of the toolbars: Main toolbar (under the SQL
Developer menus), the Connections Navigator toolbar, and (if a package or
subprogram is open) the Code Editor toolbar.
Navigate menu
Contains options for navigating to panes and in the execution of subprograms.
Back: Moves to the pane that you most recently visited.
Forward: Moves to the pane after the current one in the list of visited panes.
Toggle Bookmark: If you are editing a function or procedure, creates or removes a
bookmark (see Section 1.6.1, "Using Bookmarks When Editing Functions and
Procedures").
Remove Bookmarks from File: Removes bookmarks from the currently active editing
window for a function or procedure (see Section 1.6.1, "Using Bookmarks When
Editing Functions and Procedures").
Remove All Bookmarks: Removes bookmarks from open editing windows for
functions and procedures (see Section 1.6.1, "Using Bookmarks When Editing
Functions and Procedures").
Go to Bookmark: Displays a dialog box so that you can go to a specified bookmark
(see Section 1.6.1, "Using Bookmarks When Editing Functions and Procedures").
Go to Next Bookmark: Goes to the next bookmark in the currently active editing
window for a function or procedure (see Section 1.6.1, "Using Bookmarks When
Editing Functions and Procedures").
Go to Previous Bookmark: Goes to the previous bookmark in the currently active
editing window for a function or procedure (see Section 1.6.1, "Using Bookmarks
When Editing Functions and Procedures").
Go to Line: Goes to the specified line number and highlights the line in the editing
window for the selected function or procedure. (To display line numbers, enable Show
Line Numbers under the Code Editor: Line Gutter preferences.)
Go to Last Edit: Goes to the last line that was edited in the editing window for a
function or procedure.
Go to Recent Files: Displays the Recent Files dialog box, in which you can specify a
function or procedure to go to.
Run menu
Contains options relevant when a function or procedure is selected or when it is open
for debugging.
Run [name]: Starts execution of the specified function or procedure.
Debug [name]: Starts execution of the specified function or procedure in debug mode.
The remaining items on the Debug menu match commands on the debugging toolbar,
which is described in Section 1.6, "Running and Debugging Functions and
Procedures".
Versioning menu
Contains options related to support for the Subversion version management and
source control system, and for any other such systems (such as CVS) that you have
added as extensions to SQL Developer through the "check for updates" feature. See
Section 1.10, "Using Versioning" for more information.
The commands on the Versioning menu depend on which version management and
source control systems are available for use with SQL Developer.
Tools menu
Invokes SQL Developer tools.
Data Modeler: Starts the Data Modeler Viewer (Read-Only) if it not already active;
otherwise, contains the commands About Data Modeler, Design Rules, and General
Options (user preferences).
Migration: Displays the Migration Menu, which contains commands related to
migrating third-party databases to Oracle.
Unit Test: Displays the Unit Test Submenu, which contains commands related to unit
testing.
Configuration Palette: Displays the Configure Component Palette dialog box.
Database Copy: Enables you to copy objects from one database schema to another (see
the Database Copy (Schema Objects) interface).
Database Diff: Enables you to compare two schemas to find differences between
objects of the same type and name (for example, tables named CUSTOMERS) in two
different schemas, and optionally to update the objects in the destination schema to
reflect differences in the source schema (see the Database Schema Differences
interface).
Database Export: Enables you to export some or all objects of one or more object types
for a database connection to a file containing SQL statements to create these objects
and optionally to export table data (see the Export (Database Objects and Data)
interface).
Monitor SQL: Displays information about any query currently executing and queries
that are done executing for a selected connection. To see detailed information about a
query, right-click its row and select Show SQL Details. The information is especially
useful for real-time monitoring of long-running SQL statements. Cursor statistics (such
as CPU times and IO times) and execution plan statistics (such as number of output
rows, memory, and temporary space used) are updated close to real-time during
statement execution. (Internally, this feature calls the DBMS_SQLTUNE.REPORT_
SQL_MONITOR subprogram.)
Monitor Sessions: Displays the status of one or more sessions, using information from
the V$RSRC_SESSION_INFO view, which shows how the session has been affected by
the Oracle Database Resource Manager. For more information about session
monitoring, see Oracle Database Administrator's Guide.
SQL Worksheet: Displays a worksheet in which you can enter and execute SQL and
PL/SQL statements using a specified connection (see Section 1.7, "Using the SQL
Worksheet").
External Tools: Displays the External Tools dialog box, with information about
user-defined external tools that are integrated with the SQL Developer interface. From
this dialog box can add external tools (see Section 5.66, "Create/Edit External Tool").
The Tools menu also contains items for any user-defined external tools.
Preferences: Enables you to customize the behavior of SQL Developer (see
Section 1.12, "SQL Developer Preferences").
Help menu
Displays help about SQL Developer and enables you to check for SQL Developer
updates.
Search: Displays the Help Center window.
Table of Contents: Displays the Help Center window. In this window you can click
these icons:
■ Keep on Top: Toggles whether to keep the Help Center window on top of the Data
Modeler window.
■ Navigators: Lets you select a help navigator.
■ Print: Prints the topic.
■ Change Font Size: Lets you increase or decrease the font size for the display of the
current help topic.
■ Add to Favorites: Adds the topic to the Favorites list.
■ Find: Lets you search for a string in the current help topic.
Start Page: Displays a page with links for options for learning about SQL Developer.
Tip of the Day (English locales only): Displays a suggestion for efficient use of SQL
Developer. (See Section 1.17, "Tip of the Day".)
Check for Updates: Checks for any updates to the selected optional SQL Developer
extensions, as well as any mandatory SQL Developer extensions. The available
updates may include the JTDS JDBC Driver for Microsoft SQL Server and the MySQL
JDBE Driver, which enable you to create connections to third-party databases. (If the
system you are using is behind a firewall, see the SQL Developer user preferences for
Web Browser and Proxy.)
About: Displays version-related information about SQL Developer and its
components.
Note: The actions available from context menus and Actions buttons
depend on the Oracle Database release number for the specified
database connection. If an action mentioned in the text is not available
with a connection, it may be that the feature was not available in that
release of Oracle Database.
You can search for specific objects associated with an Oracle database connection by
clicking the Search icon, as explained in Section 1.9, "Finding Database Objects".
If you have connected to any third-party (non-Oracle) databases, such as MySQL,
Microsoft SQL Server, Sybase Adaptive Server, Microsoft Access, or IBM DB2, you can
view their objects using the Connections navigator. (For information about connecting
to third-party databases, see the SQL Developer user preferences for Database: Third
Party JDBC Drivers.)
operation is a PL/SQL script, which you can review and save, and which you can
execute to create the package.
The following operations are available only by right-clicking the Application Express
node in the Connections navigator and selecting an item from the menu:
■ Start EPG: Starts the embedded PL/SQL gateway for Application Express.
Displays a dialog box for executing the following statements: BEGIN DBMS_
EPG.map_dad('APEX', '/apex/*'); end;
■ Stop EPG: Stops the embedded PL/SQL gateway for Application Express.
Displays a dialog box for executing the following statements: BEGIN DBMS_
EPG.unmap_dad('APEX'); end;
1.3.4 Directories
A directory object specifies an alias for a directory (called a folder on Windows
systems) on the server file system where external binary file LOBs (BFILEs) and
external table data are located. To create a directory (that is, a directory object), you can
use SQL Developer or the SQL statement CREATE DIRECTORY.
You can use directory names when referring to BFILEs in your PL/SQL code and OCI
calls, rather than hard coding the operating system path name, for management
flexibility. All directories are created in a single namespace and are not owned by an
individual schema. You can secure access to the BFILEs stored within the directory
structure by granting object privileges on the directories to specific users.
1.3.5 Editions
Edition-based redefinition (introduced in Oracle Database Release 11.2) enables you to
upgrade the database component of an application while it is in use, thereby
minimizing or eliminating down time. To upgrade an application while it is in use,
you copy the database objects that comprise the application and redefine the copied
objects in isolation. Your changes do not affect users of the application—they continue
to run the unchanged application. When you are sure that your changes are correct,
you make the upgraded application available to all users. For more information, see
the chapter about edition-based redefinition in Oracle Database Advanced Application
Developer's Guide.
To specify the current edition, right-click the edition name and select Set Current
Edition. To create an edition under an existing edition, right-click the edition name
and select Create Edition. To delete an edition (and optionally all editions under it),
right-click the edition name and select Drop Edition.
1.3.6 Functions
A function is a type of PL/SQL subprogram, which is a programming object that can
be stored and executed in the database server, and called from other programming
objects or applications. (Functions return a value; procedures do not return a value.)
For help with specific options in creating a PL/SQL subprogram, see Section 5.31,
"Create PL/SQL Subprogram (Function or Procedure)".
You can perform the following operations on a function by right-clicking the function
name in the Connections navigator and selecting an item from the menu:
■ Edit: Displays the function text so that you can view and edit it.
■ Run: Displays the Run/Debug/Profile PL/SQL dialog box, and then executes the
function in normal (not debug) mode.
■ Compile: Performs a PL/SQL compilation of the function.
■ Compile for Debug: Performs a PL/SQL compilation of the procedure, with
PL/SQL library units compiled for debugging.
■ Profile (for an Oracle Database Release 11.1 or later connection): Displays the
Run/Debug/Profile PL/SQL dialog box, and then executes the function and
collects execution statistics.
■ Drop: Deletes the function.
■ Grant: Enables you to grant available privileges on the function to selected users.
■ Revoke: Enables you to revoke available privileges on the function from selected
users.
■ Format: Reformats the text of the function definition.
■ Create Unit Test: Creates a unit test (see Chapter 3) for the function.
■ Export DDL: Enables you to export the DDL statement for creating the function to
a file, a SQL Worksheet, or the clipboard.
1.3.7 Indexes
An index is a database object that contains an entry for each value that appears in the
indexed column(s) of the table or cluster and provides direct, fast access to rows.
Indexes are automatically created on primary key columns; however, you must create
indexes on other columns to gain the benefits of indexing. For help with specific
options in creating an index, see Section 5.27, "Create/Edit Index".
You can perform the following operations on an index by right-clicking the index
name in the Connections navigator and selecting an item from the menu:
■ Drop: Deletes the index.
■ Rebuild Index: Re-creates the index or one of its partitions or subpartitions. If the
index is unusable, a successful rebuild operation makes the index usable. For a
function-based index, rebuilding also enables the index; however, if the function
on which the index is based does not exist, the rebuild operation fails.
■ Rename Index: Changes the name of the index.
■ Make Unusable: Prevents the index from being used by Oracle in executing
queries. An unusable index must be rebuilt, or dropped and re-created, before it
can be used again.
■ Coalesce: Merges the contents of index blocks, where possible, to free blocks for
reuse.
■ Compute Statistics: For a function-based index, collects statistics on both the
index and its base table using the DBMS_STATS package. Such statistics will
enable Oracle Database to correctly decide when to use the index.
■ Export DDL: Saves the DDL statement to create the index to a file, a SQL
Worksheet, or the system clipboard.
1.3.9 Jobs
A job object (job) is a collection of metadata that describes a user-defined task. It
defines what needs to be executed (the action), when (the one-time or recurring
schedule or a triggering event), where (the destinations), and with what credentials. A
job has an owner, which is the schema in which it is created. For information about
jobs, see the chapter about Oracle Scheduler concepts in Oracle Database Administrator's
Guide.
reexecute the materialized view query to refresh the materialized view. This process is
called a complete refresh. Usually, a fast refresh takes less time than a complete refresh.
1.3.12 Packages
A package is an object that contains subprograms, which are programming objects that
can be stored and executed in the database server, and called from other programming
objects or applications. A package can contain functions or procedures, or both. For
help with specific options in creating a package, see Section 5.30, "Create PL/SQL
Package".
You can perform the following operations on a package by right-clicking the package
name in the Connections navigator and selecting an item from the menu:
■ Edit: Opens the package in a window, where you can modify the content and
other information.
■ Run: Lets you select a member in the package and run it.
■ Compile: Performs a PL/SQL compilation of the members in the package.
■ Compile for Debug: Performs a PL/SQL compilation of the members in the
package, with PL/SQL library units compiled for debugging
■ Order Members By: Orders the members of the package by location in the source,
by name, or by type and by name within each type.
■ Use as Template: Lets you create a new package using the selected package as the
initial content.
■ Drop Package: Deletes the package.
■ Create Body: Displays a pane in which you can enter text for the package body.
■ Grant: Lets you grant privileges on the package
■ Revoke: Lets you revoke privileges on the package.
■ Save Package Spec and Body: Saves the package specification and body to a file
that you specify.
■ Export DDL: Saves the DDL statement to create the package to a file, a SQL
Worksheet, or the system clipboard.
1.3.13 Procedures
A procedure is a type of PL/SQL subprogram, which is a programming object that can
be stored and executed in the database server, and called from other programming
objects or applications. (Procedures do not return a value; functions return a value.)
For help with specific options in creating a PL/SQL subprogram, see Section 5.31,
"Create PL/SQL Subprogram (Function or Procedure)".
You can perform the following operations on a procedure by right-clicking the
procedure name in the Connections navigator and selecting an item from the menu:
■ Edit: Displays the procedure text so that you can view and edit it.
■ Run: Displays the Run/Debug/Profile PL/SQL dialog box, and then executes the
procedure in normal (not debug) mode.
■ Compile: Performs a PL/SQL compilation of the procedure.
■ Compile for Debug: Performs a PL/SQL compilation of the procedure, with
PL/SQL library units compiled for debugging.
■ Profile (for an Oracle Database Release 11.1 or later connection): Displays the
Run/Debug/Profile PL/SQL dialog box, and then executes the procedure and
collects execution statistics.
■ Drop: Deletes the procedure.
■ Grant: Enables you to grant available privileges on the procedure to selected
users.
■ Revoke: Enables you to revoke available privileges on the procedure from selected
users.
■ Format: Reformats the text of the procedure definition.
■ Create Unit Test: Creates a unit test (see Chapter 3) for the procedure.
■ Export DDL: Enables you to export the DDL statement for creating the procedure
to a file, a SQL Worksheet, or the clipboard.
1.3.14 Queues
A queue is an object in which messages are enqueued and dequeued. Queues are
managed by Oracle Streams Advanced Queueing (AQ). For information about using
queues, see Oracle Streams Advanced Queuing User's Guide.
1.3.18 Sequences
Sequences are used to generate unique integers. You can use sequences to
automatically generate primary key values. For help with specific options in creating
and editing a sequence, see Section 5.32, "Create/Edit Sequence".
1.3.20 Tables
Tables are used to hold data. Each table typically has multiple columns that describe
attributes of the database entity associated with the table, and each column has an
associated data type. You can choose from many table creation options and table
organizations (such as partitioned tables, index-organized tables, and external tables),
to meet a variety of enterprise needs. To create a table, you can do one of the following:
■ Create the table quickly by adding columns and specifying frequently used
features. To do this, do not check the Advanced box in the Create Table dialog box.
For help with options for creating a table using this quick approach, see Create
Table (quick creation).
■ Create the table by adding columns and selecting from a larger set of features. To
do this, check the Advanced box in the Create Table dialog box. For help with
options for creating a table with advanced features, see Create/Edit Table (with
advanced options).
■ Create the table automatically from a Microsoft Excel worksheet. To do this,
right-click Tables under a connection in the Connections navigator, and select
Import Data. When asked for the file, select a file of type .xls or .csv.
You can perform the following operations on a table by right-clicking the table name in
the Connections navigator and selecting an item from the menu:
■ Edit: Displays the Create/Edit Table (with advanced options) dialog box.
■ Table: Table actions include Rename, Copy (create a copy using a different name),
Drop (delete the table), Truncate (delete existing data without affecting the table
definition), Lock (set the table lock mode: row share, exclusive, and so on),
Comment (descriptive comment explaining the use or purpose of the table),
Parallel (change the default degree of parallelism for queries and DML on the
table), No Parallel (specify serial execution), and Count Rows (return the number
of rows).
■ Column: Column actions include Comment (descriptive comment about a
column), Add, Drop, and Normalize.
■ Constraint: Includes options for adding, dropping, enabling, and disabling
constraints.
■ Index: Options include Create (create an index on specified columns), Create Text
(create an Oracle Text index on a column), Create Text (create a function-based
index on a column), and Drop.
review the syntax required to undo changes. For information about using the
Flashback Table feature, see Oracle Database Backup and Recovery User's Guide.
1.3.21 Triggers
Triggers are stored PL/SQL blocks associated with a table, a schema, or the database,
or anonymous PL/SQL blocks or calls to a procedure implemented in PL/SQL or Java.
Oracle Database automatically executes a trigger when specified conditions occur. For
help with specific options in creating a trigger, see Section 5.38, "Create Trigger".
1.3.22 Types
A data type associates a fixed set of properties with the values that can be used in a
column of a table or in an argument of a function or procedure. These properties cause
Oracle Database to treat values of one data type differently from values of another
data type. Most data types are supplied by Oracle, although users can create data
types.
For help with specific options in creating a user-defined type, see Section 5.39, "Create
Type (User-Defined)".
1.3.24 Views
Views are virtual tables (analogous to queries in some database products) that select
data from one or more underlying tables. Oracle Database provides many view
creation options and specialized types of views (such as materialized views, described
in Section 1.3.10, "Materialized Views"), to meet a variety of enterprise needs. For help
with specific options in creating and editing a view, see Create/Edit View.
You can perform the following operations on a view by right-clicking the view name
in the Connections navigator and selecting an item from the menu:
■ Edit: Displays the Create/Edit View dialog box.
■ Drop: Deletes the view.
■ Compile: Recompiles the view, to enable you to locate possible errors before run
time. You may want to recompile a view after altering one of its base tables to
ensure that the change does not affect the view or other objects that depend on it.
tnsnames.ora file on your system, if that file exists. You can specify the tnsnames.ora
location in the Database: Advanced preferences.By default, tnsnames.ora is located in
the $ORACLE_HOME/network/admin directory, but it can also be in the directory
specified by the TNS_ADMIN environment variable or registry value or (on Linux
systems) the global configuration directory. On Windows systems, if the tnsnames.ora
file exists but its connections are not being used by SQL Developer, define TNS_
ADMIN as a system environment variable. For information about the tnsnames.ora
file, see the "Local Naming Parameters (tnsnames.ora)" chapter in Oracle Database Net
Services Reference.
You can create additional connections (for example, to connect to the same database
but as different users, or to connect to different databases). Each database connection is
listed in the Connections navigator hierarchy.
To create a new database connection, right-click the Connections node and select New
Database Connection. Use the dialog box to specify information about the connection
(see Section 5.13, "Create/Edit/Select Database Connection"). You can also create a
new database connection by selecting an existing connection in that dialog box,
changing the connection name, changing other connection attributes as needed, and
clicking Save or Connect.
To create database connection for each unlocked user account in the Oracle database
instance on the local system, right-click the Connections node and select Create Local
Connections. The generated connections are placed in a folder. You can then edit the
connections as needed.
To edit the information about an existing database connection, right-click the
connection name in the Connections navigator display and select Properties. Use the
dialog box to modify information about the connection, but do not change the
connection name. (See Section 5.13, "Create/Edit/Select Database Connection".)
To organize connection groups using folders, see Section 1.4.1, "Using Folders to
Group Connections".
To export information about the existing database connections into an XML file that
you can later use for importing connections, right-click Connections in the
Connections navigator display and select Export Connections. Use the dialog box to
specify the connections to be exported (see Section 5.25, "Export/Import Connection
Descriptors").
To import connections that had previously been exported (adding them to any
connections that may already exist in SQL Developer), right-click Connections in the
Connections navigator display and select Import Connections. Use the dialog box to
specify the connections to be imported (see Section 5.25, "Export/Import Connection
Descriptors").
To perform limited database management operations if you are connected AS
SYSDBA, right-click the connection name in the Connections navigator display and
select Manage Database. You can click to refresh the read-only display of memory
(SGA and PGA) and tablespace information. If a listener is running with a static
listener configured for the database, you can also click to start and stop the database.
To perform remote debugging if you are using the Sun Microsystem's Java Platform
Debugger Architecture (JPDA) and you would like the debugger to listen so that a
debuggee can attach to the debugger, right-click the connection name in the
Connections navigator display and select Remote Debug. Use the dialog box to
specify remote debugging information (see Section 5.52, "Debugger - Attach to JPDA").
4. In the Oracle Proxy Connection dialog box, select User Name for Proxy Type
5. For Proxy User, enter PROXY_USER; and for Proxy Password, enter the password
for the PROXY_USER database user.
6. Click OK to close the Oracle Proxy Connection dialog box.
7. Complete any other necessary connection information, and click Connect to create
the connection.
In this example, when you connect using the proxy_conn connection, the user name
and password for user SCOTT are used to connect to the database, but the connection
sees those database objects that the PROXY_USER user is permitted to see.
The preceding instructions cause two sessions to be started (one for the proxy user and
one for the proxy client) when the connection is opened. If you want to have a single
session (with no second password or distinguished name required) started, you can
follow these steps instead after you create the proxy user and grant it appropriate
privileges:
1. Create a new database connection. For example: connection name = proxy_conn,
user name = proxy_user[scott], password = <password for proxy_user>.
2. For Connection Type, specify TNS.
(Note: Do not enable Proxy Connection.)
3. For Network Alias, select the network alias for the database for the connection.
4. Complete any other necessary connection information, and click Connect to create
the connection.
Icons and other controls under the Data tab provide the following options:
■ Freeze View (the pin) keeps that object’s tab and information in the window when
you click another object in the Connections navigator; a separate tab and display
are created for that other object. If you click the pin again, the object’s display is
available for reuse.
■ Refresh queries the database to update the data display. If a filter is specified, the
refresh operation uses the filter.
■ Insert Row adds an empty row after the selected row, for you to enter new data.
■ Delete Selected Row(s) marks the selected rows for deletion. The actual deletion
does not occur until you commit changes.
■ Commit Changes ends the current transaction and makes permanent all changes
performed in the transaction.
■ Rollback Changes undoes any work done in the current transaction.
■ Sort displays a dialog box for selecting columns to sort by. For each column, you
can specify ascending or descending order, and you can specify that null values be
displayed first.
■ Filter enables you to enter a SQL predicate (WHERE clause text without the
WHERE keyword) for limiting the display of data. For example, to show only
rows where the RATING column value is equal to 10, specify: rating = 10
■ Filter Column enables you to enter a partial value (such as a number or a string; at
least two characters for a string), to limit the dialog box display to items
containing the partial value, so that you can then select the one item to appear in
the grid. For example, entering EMP for column names might show a list of
columns including EMPLOYEE_ID and IS_TEMP.
■ Actions displays a menu with actions relevant to the table.
When you enter a cell in the grid, you can directly edit the data for many data types,
and for all data types you can click the ellipsis (...) button to edit the data. For binary
data you cannot edit the data in the cell, but must use the ellipsis button.
In the data grid, the context menu (right-click) includes the following commands:
■ Single Record View displays the Single Record View dialog box, which enables
you to edit data for a table or view, one record at a time.
■ Auto-fit All Columns adjusts the width of all columns according to your
specification (by column header, by column data, or best fit).
■ Auto-fit Selected Columns adjusts the width of the selected columns according to
your specification (by column header, by column data, or best fit).
■ Count Rows displays the number of rows in the table.
■ Publish to Apex (if Application Express is installed) creates a small Application
Express application based on the data. It displays a dialog box in which you
specify the following for the application to be created: workspace, application
name, theme, page name, and SQL statement for generating the report.
■ Export Data enables you to export some or all of the table data to a file or to the
system clipboard, in any of the following formats: XML (XML tags and data), CSV
(comma-separated values including a header row for column identifiers), SQL
Insert (INSERT statements), or SQL Loader (SQL*Loader control file). After you
select a format, the Export Table Data dialog box is displayed.
You can copy and paste data between table grid cells and cells in a Microsoft Excel
worksheet.
To copy table data to the clipboard, click the column header (for all column data) or
select specific cells and press Ctrl+C; to copy the column header text along with the
table data, press Ctrl+Shift+C.
To sort the display of rows by values within a column, double-click the column
header; to switch between ascending and descending sorting, double-click the
up/down arrow in the column header.
In the Data pane for a table or view, you can split the display vertically or horizontally
to see two (or more) parts independently by using the split box (thin blue rectangle),
located to the right of the bottom scroll bar and above the right scroll bar.
In the Data pane, the acceptable format or formats for entering dates may be different
from the date format required by SQL*Plus.
In the code editing window, under the tab with the name of the subprogram, is a
toolbar, and beneath it is the text of the subprogram, which you can edit. You can set
and unset breakpoints for debugging by clicking to the left of the thin vertical line
beside each statement with which you want to associate a breakpoint. (When a
breakpoint is set, a red circle is displayed.)
The toolbar under the tab for the subprogram name includes the icons shown in the
following figure.
■ Run starts normal execution of the subprogram, and displays the results in the
Running - Log tab.
■ Debug starts execution of the subprogram in debug mode, and displays the
Debugging - Log tab, which includes the debugging toolbar for controlling the
execution.
■ Make - Compile for Debug performs a PL/SQL compilation of the subprogram so
that it can be debugged.
■ Make - Compile performs a PL/SQL compilation of the subprogram.
■ Profile displays the Run/Debug/Profile PL/SQL dialog box.
The Debugging - Log tab under the code text area contains the debugging toolbar and
informational messages. The debugging toolbar has the icons shown in the following
figure.
■ Find Execution Point goes to the execution point (the next line of source code to
be executed by the debugger).
■ Step Over bypasses the next subprogram (unless the subprogram has a
breakpoint) and goes to the next statement after the subprogram. If the execution
point is located on a subprogram call, it runs that subprogram without stopping
(instead of stepping into it), then positions the execution point on the statement
that follows the call. If the execution point is located on the last statement of a
subprogram, Step Over returns from the subprogram, placing the execution point
on the line of code that follows the call to the subprogram from which you are
returning.
■ Step Into executes a single program statement at a time. If the execution point is
located on a call to a subprogram, Step Into steps into that subprogram and places
the execution point on its first statement. If the execution point is located on the
last statement of a subprogram, Step Into returns from the subprogram, placing
the execution point on the line of code that follows the call to the subprogram from
which you are returning.
■ Step Out leaves the current subprogram and goes to the next statement.
■ Step to End of Method goes to the last statement of the current subprogram.
■ Resume continues execution.
■ Pause halts execution but does not exit, thus allowing you to resume execution.
■ Terminate halts and exits the execution. You cannot resume execution from this
point; instead, to start running or debugging from the beginning of the
subprogram, click the Run or Debug icon in the Source tab toolbar.
The Breakpoints tab displays breakpoints, both system-defined and user-defined.
The Smart Data tab displays information about variables, using your Debugger: Smart
Data preferences. You can also specify these preferences by right-clicking in the Smart
Data window and selecting Preferences.
The Data tab displays information about variables, using your Debugger: Data
preferences. You can also specify these preferences by right-clicking in the Data
window and selecting Preferences.
The Watches tab displays information about watches (see Section 1.6.5, "Setting
Expression Watches").
If the function or procedure to be debugged is on a remote system, see also
Section 1.6.2, "Remote Debugging".
The first parameter is the IP address or host name of the remote system, and the
second parameter is the port number on that remote system on which the
debugger is listening.
2. Right-click the connection for the remote database, select Remote Debug, and
complete the information in the Debugger - Attach to JPDA dialog box.
Then, follow the steps that you would for local debugging (for example, see
Section 4.8, "Debug a PL/SQL Procedure").
information, click File, then Open, and specify the file; or drag the file’s name or icon
into the SQL Developer window.
You can then examine the information in the List View, Statistics View, and History
panes, with each pane including options for filtering and controlling the display.
For information about SQL Trace and TKPROF, see Oracle Database Performance Tuning
Guide.
connection associated with the worksheet, such as creating a table, inserting data,
creating and editing a trigger, selecting data from a table, and saving that data to a file.
You can display a SQL Worksheet by right-clicking a connection in the Connections
navigator and selecting Open SQL Worksheet, by selecting Tools and then SQL
Worksheet, or by clicking the Use SQL Worksheet icon under the menu bar. In the
Select Connection dialog box, select the database connection to use for your work with
the worksheet. You can also use that dialog box to create and edit database
connections. (You can have a SQL Worksheet window open automatically when you
open a database connection by enabling the appropriate SQL Developer user
preference under Database Connections.)
To create a separate unshared worksheet for a connection, use Ctrl+Shift+N.
The SQL Worksheet has the user interface shown in the following figure:
SQL Worksheet toolbar (under the Worksheet tab): Contains icons for the following
operations:
■ Execute Statement executes the statement at the mouse pointer in the Enter SQL
Statement box. The SQL statements can include bind variables and substitution
variables of type VARCHAR2 (although in most cases, VARCHAR2 is
automatically converted internally to NUMBER if necessary); a pop-up box is
displayed for entering variable values.
■ Run Script executes all statements in the Enter SQL Statement box using the Script
Runner. The SQL statements can include substitution variables (but not bind
variables) of type VARCHAR2 (although in most cases, VARCHAR2 is
automatically converted internally to NUMBER if necessary); a pop-up box is
displayed for entering substitution variable values.
■ Commit writes any changes to the database, and ends the transaction; also clears
any output in the Results and Script Output panes.
■ Rollback discards any changes without writing them to the database, and ends
the transaction; also clears any output in the Results and Script Output panes.
■ Cancel stops the execution of any statements currently being executed.
■ Monitor SQL Status (Oracle Database Release 11.1 and later only) calls the
real-time SQL monitoring feature of Oracle Database, enabling you to monitor the
performance of SQL statements while they are executing.
■ Explain Plan generates the execution plan for the statement (internally executing
the EXPLAIN PLAN statement). To see the execution plan, click the Explain tab.
For more information, see Section 1.7.3, "Execution Plan".
■ Autotrace generates trace information for the statement. To see the Autotrace
Pane, click the Autotrace tab.
■ Clear erases the statement or statements in the Enter SQL Statement box.
■ To the right of these icons is a drop-down list for changing the database
connection to use with the worksheet.
The context menu (right-click, or Shift+F10) includes the preceding SQL Worksheet
toolbar operations, plus the following operations (some depending on the type of
object displayed in the worksheet):
■ Print File prints the contents of the Enter SQL Statement box.
■ Cut, Copy, Paste, and Select All have the same meanings as for normal text
editing operations.
■ Query Builder opens the Query Builder dialog box, where you can create a
SELECT statement by dragging and dropping table and view names and by
graphically specifying columns and other elements of the query.
■ Refactoring enables you to do the following on selected text: switch character case
(to upper/lower/initcap), extract the sequence of PL/SQL statements to a
procedure, or rename the local variable.
■ Format formats the SQL statement (capitalizing the names of statements, clauses,
keywords, and so on).
■ Advanced Format displays a dialog box where you can specify the output
destination and output type for the formal operation.
■ Quick Outline displays the Outline pane with a graphical outline of the object
displayed in the worksheet (if an outline is relevant for this type of object). You can
click a node in the outline to go to the associated place in the text in the worksheet.
■ Popup Describe, if the name of a database object is completely selected, displays a
window with tabs and information appropriate for that type of object (see
Section 5.54, "Describe Object Window").
■ Save Snippet opens the Save Snippet (User-Defined) dialog box with the selected
text as the snippet text.
Enter SQL Statement: The statement or statements that you intend to execute. For
multiple statements, each non-PL/SQL statement must be terminated with either a
semicolon or (on a new line) a slash (/), and each PL/SQL statement must be
terminated with a slash (/) on a new line. SQL keywords are automatically
highlighted. To format the statement, right-click in the statement area and select
Format SQL.
You can drag some kinds of objects from the Connections navigator and drop them
into the Enter SQL Statement box:
■ If you drag and drop a table or view, by default a SELECT statement is constructed
with all columns in the table or view. You can then edit the statement, for example,
modifying the column list or adding a WHERE clause.
sta[rt]
spo[ol]
term[out]
timi[ng]
undef[ine]
user
var[iable]
ver[ify]
whenever
xquery
The following SQL*Plus statements are not supported by the SQL Worksheet:
a[ppend]
archive
attr[ibute]
bre[ak]
bti[tle]
c[hange]
col[umn]
comp[ute]
copy
del
disc[onnect]
ed[it]
get
help
i[nput]
l[ist]
newpage
oradebug
passw[ord]
r[un]
recover
repf[ooter]
reph[eader]
sav[e]
startup
sho[w]
shu[tdown]
spo[ol]
startup
store
tti[tle]
you can display the buffered information by calling the GET_LINE procedure. The
DBMS Output pane is used to display the output of that buffer. This pane contains
icons and other controls for the following operations:
■ Add New DBMS Output Tab: Prompts you to specify a database connection, after
which a tab is opened within the DBMS Output pane for that connection, and the
SET SERVEROUTPUT setting is turned on so that any output is displayed in that
tab. (To stop displaying output for that connection, close the tab.)
■ Clear: Erases the contents of the pane.
■ Save: Saves the contents of the pane to a file that you specify.
■ Print: Prints the contents of the pane.
■ Buffer Size: For databases before Oracle Database 10.2, limits the amount of data
that can be stored in the DBMS_OUTPUT buffer. The buffer size can be between 1
and 1000000 (1 million).
■ Poll: The interval (in seconds) at which SQL Developer checks the DBMS_
OUTPUT buffer to see if there is data to print. The poll rate can be between 1 and
15.
dragging them from the SQL History window and dropping them at the desired
location on the SQL Worksheet.
Replace: Replaces any statements currently on the SQL Worksheet with the selected
statement or statements.
Clear History: Removes the selected statement or statements (or all statements if no
statements are selected) from the SQL history. (You will be asked to confirm this
action.)
Filter: If you type a string in the text box and click Filter, only SQL statements
containing that string are displayed.
If you specify 104 as the bind variable value, the output appears as shown in the
following figure:
For a user-defined gauge report, the query must specify only the value column, the
minimum and maximum values, and the low and high values, and optionally a
WHERE clause. The required structure for the query (before any optional WHERE
clause) is:
SELECT <value-column>, <min>, <max>, <low>, <high> FROM <table-name>
For example, to create a report of salaries in gauge dial format, with the same values
and WHERE clause as in the preceding query, right-click on User Defined Reports in
the Reports navigator and select Add Report. In the Add Report dialog box, specify a
report name; for Style, select Gauge; and for SQL, enter the following:
SELECT salary, 1000, 30000, 10000, 18000 FROM employees
WHERE employee_id < :EMPLOYEE_ID;
Click the Chart Details tab near the bottom of the box; for Chart Type, select DIAL; for
Query Based, select true; and click Apply.
Use the Reports navigator to view the newly created user-defined report. For
Connection, specify one that connects to the HR sample schema. For the bind variable
value, specify 104. The report shows four semicircular dials, each with a label
containing the salary amount and a "needle" pointing to an appropriate place on the
dial.
documentation does not provide detailed information about the concepts and
operations of such systems; it assumes that you know them or can read about them in
the product documentation.
■ For information about CVS, see http://ximbiot.com/cvs/wiki/. For the
CVS manual (by Per Cederqvist and others), see
http://ximbiot.com/cvs/manual/.
■ For information about Subversion, see http://subversion.tigris.org/. For
Subversion documentation, see http://svnbook.red-bean.com/.
To access the versioning features of SQL Developer, use the Versioning menu.
If you create any versioning repositories, you can use the hierarchical display in the
Files navigator, which is marked by a folder icon. (If that navigator is not visible, click
View, then Files.) You can also view a hierarchical display of repositories and their
contents in the Versioning navigator.
to it is automatically created, and this can be seen in the Subversion Navigator. You
can subsequently edit the connection details.
Existing files must be imported into the Subversion repository to bring them under
version control. Files are then checked out from the Subversion repository to a local
folder known as the "Subversion working copy". Files created in (or moved into) SQL
Developer must be stored in the Subversion working copy.
Files newly created within SQL Developer must be added to version control. Changed
and new files are made available to other users by committing them to the SQL
Developer repository. The Subversion working copy can be updated with the contents
of the Subversion repository to incorporate changes made by other users.
you to find if any changes to the object definitions have been made on or after a
specific time.
Collection Types: Lists information about for each collection type. The information
includes the type owner, element type name and owner, and type-dependent specific
information.
Dependencies: For each object with references to it, lists information about references
to (uses of) that object.
Invalid Objects: Lists all objects that have a status of invalid.
Object Count by Type: For each type of object associated with a specific owner, lists
the number of objects. This report might help you to identify users that have created
an especially large number of objects, particularly objects of a specific type.
Public Database Links: Lists all public database links.
Public Synonyms: Lists all public synonyms.
Top SQL: Provide information about SQL statements, selected and ordered by various
criteria. This information might help you to identify SQL statements that are being
executed more often than expected or that are taking more time than expected.
Users: Provide information about database users, selected and ordered by various
criteria. For example, you can find out which users were created most recently, which
user accounts have expired, and which users use object types and how many objects
each owns.
Waits and Events: Provide information about waits and events, selected by criteria
related to time and other factors. For Events in the Last x Minutes, specify the number
of minutes in the Enter Bind Values dialog box.
Comments for tables and columns: For each table and for each column in each table,
lists the descriptive comments (if any) associated with it. Also includes a report of
tables without comments. If database developers use the COMMENT statement when
creating or modifying tables, this report can provide useful information about the
purposes of tables and columns
Constraints: Includes the following reports related to constraints:
■ All Constraints: For each table, lists each associated constraint, including its type
(unique constraint, check constraint, primary key, foreign key) and status (enabled
or disabled).
■ Check Constraints: For each check constraint, lists information that includes the
owner, the table name, the constraint name, the constraint status (enabled or
disabled), and the constraint specification.
■ Enabled Constraints and Disabled Constraints: For each constraint with a status
of enabled or disabled, lists the table name, constraint name, constraint type
(unique constraint, check constraint, primary key, foreign key), and status. A
disabled constraint is not enforced when rows are added or modified; to have a
disabled constraint enforced, you must edit the table and set the status of the
constraint to Enabled (see the appropriate tabs for the Create/Edit Table (with
advanced options) dialog box).
■ Foreign Key Constraints: For each foreign key constraint, lists information that
includes the owner, the table name, the constraint name, the column that the
constraint is against, the table that the constraint references, and the constraint in
the table that is referenced.
■ Primary Key Constraints: For primary key constraint, lists information that
includes the owner, the table name, the constraint name, the constraint status
(enabled or disabled), and the column name.
■ Unique Constraints: For each unique constraint, lists information that includes
the owner, the table name, the constraint name, the constraint status (enabled or
disabled), and the column name.
Indexes: Includes information about all indexes, indexes by status, indexes by type,
and unused indexes.
Organization: Specialized reports list information about partitioned tables, clustered
tables, and index-organized tables.
Quality Assurance: (See Quality Assurance reports.)
Statistics: For each table, lists statistical information, including when it was last
analyzed, the total number of rows, the average row length, and the table type. In
addition, specialized reports order the results by most rows and largest average row
length.
Storage: Lists information about the table count by tablespace and the tables in each
tablespace.
Triggers: Lists information about all triggers, disabled triggers, and enabled triggers.
User Synonyms: Displays information about either all user synonyms or those user
synonyms containing the string that you specify in the Enter Bind Variables dialog box
(uncheck Null in that box to enter a string).
User Tables: Displays information about either all tables or those tables containing the
string that you specify in the Enter Bind Variables dialog box (uncheck Null in that box
to enter a string).
The preceding query lists the last name and salary of each employee in each
department, grouping the results by department ID (10, 20, 30, ... 110). Note that the
expected syntax for the SQL statement for a chart report is:
SELECT <group>,<series>,<value> FROM <table(s)>
Click the Chart Details tab near the bottom of the box; for Chart Type, select BAR_
VERT_STACK (bar chart, stacked vertically); and click Apply.
Use the Reports navigator to view the newly created user-defined report. For
Connection, specify one that connects to the HR sample schema.
The report is displayed as a chart, part of which is shown in the following illustration.
For example, as you can see, department 50 has mainly employees with the lowest
salaries, and department 90 consists of the three highest-paid employees.
Use the Reports navigator to view the newly created user-defined report. For
Connection, specify any from the list. (This report does not depend on a specific
connection of table.).
The report is displayed as formatted HTML output.
1.12.1 Environment
The Environment pane contains options that affect the startup and overall behavior
and appearance of SQL Developer. You can specify that certain operations be
performed automatically at specified times, with the trade-off usually being the extra
time for the operation as opposed to the possibility of problems if the operation is not
performed automatically (for example, if you forget to perform it when you should).
The undo level (number of previous operations that can be undone) and navigation
level (number of open files) values involve slight increases or decreases system
resource usage for higher or lower values.
Automatically Reload Externally Modified Files: If this option is checked, any files
open in SQL Developer that have been modified by an external application are
updated when you switch back to SQL Developer, overwriting any changes that you
might have made. If this option is not checked, changes that you make in SQL
Developer overwrite any changes that might have been made by external applications.
Silently Reload When File Is Unmodified: If this option is checked, you are not asked
if you want to reload files that have been modified externally but not in SQL
Developer. If this option is not checked, you are asked if you want to reload each file
that has been modified externally, regardless of whether it has been modified in SQL
Developer.
Environment: Log
The Log pane configures the colors of certain types of log messages and the saving of
log messages to log files.
Save Logs to File: If this option is checked, all output to the Messages - Log window is
saved to log files, where the file name reflects the operation and a timestamp. You are
also asked to specify a Log Directory; and if the specified directory does not already
exist, it is created. Note that if you save log information to files, the number of these
files can become large.
Maximum Log Lines: The maximum number of lines to store in each log file.
Enable Cut or Copy of Current Line with No Selection: Applies all cut and copy
operations to the current line whenever there is no text selection in the editor.
Automatically Copy Paste Imports: Automatically add imports when references are
introduced to objects that have not yet been imported.
Adjust Indentation When Pasting: Corrects the indentation of a pasted in item that
includes indentation.
Reformat Code Block When Pasting: Reformats the code correctly when you paste it
into a new location.
Escape When Pasting in String Literals: Includes the correct escape characters in
pasted-in string literals.
with hard tabs, or vice versa. Otherwise, every line in the two documents might be
shown as different in the Compare window.
Show Character Differences: If this option is enabled, characters that are present in
one file and not in another are highlighted. Red highlighting indicates a character that
has been removed. Green highlighting indicates a character that has been added. The
highlighting is shown only when you click into a comparison block that contains
character differences.
Enable XML Compare: If this option is enabled, XML files can be compared.
Enable XML Merge: If this option is enabled, XML files can be merged.
Reformat Result: If this option is enabled, merged XML files can be reformatted.
Validate Result (May require Internet access): If this option is enabled, merged XML
files will be validated.
1.12.4 Database
The Database pane sets properties for the database connection.
Validate date and time default values: If this option is checked, date and time
validation is used when you open tables.
Default path to store export in: Default path of the directory or folder under which to
store output files when you perform an export operation. To see the current default for
your system, click the Browse button next to this field.
Filename for connection startup script: File name for the startup script to run when
an Oracle database connection is opened. You can click Browse to specify the location.
The default location is the default path for scripts (see the Database: Worksheet
preferences pane).
Database: Advanced
The Advanced pane specifies options such as the SQL array fetch size and display
options for null values.
You can also specify Kerberos thin driver configuration parameters, which enables you
to create database connections using Kerberos authentication and specifying the user
name and password. For more information, see the Kerberos Authentication
explanation on the Oracle tab in the Create/Edit/Select Database Connection dialog
box. For information about configuring Kerberos authentication, see Oracle Database
Advanced Security Administrator's Guide.
Use OCI/Thick driver: If this option is checked, and if an OCI (thick, Type 2) driver is
available, that driver will be used instead of a JDBC (thin) driver for basic and TNS
(network alias) database connections. If any connections use a supported Remote
Authentication Dial In User Service (RADIUS) server, check this option.
Kerberos Thin Config: Config File: Kerberos configuration file (for example,
krb5.conf). If this is not specified, default locations will be tried for your Java and
system configuration.
Kerberos Thin Config: Credential Cache File: Kerberos credential cache file (for
example, krb5_cc_cache). If this is not specified, a cache will not be used, and a
principal name and password will be required each time.
Tnsnames Directory: Enter or browse to select the location of the tnsnames.ora file. If
no location is specified, SQL Developer looks for this file as explained in Section 1.4,
"Database Connections". Thus, any value you specify here overrides any TNS_ADMIN
environment variable or registry value or (on Linux systems) the global configuration
directory.
Database: NLS
The NLS pane specifies values for globalization support parameters, such as the
language, territory, sort preference, and date format. These parameter values are used
for SQL Developer session operations, such as for statements executed using the SQL
Worksheet and for the National Language Support Parameters report. Specifying
values in this preferences pane does not apply those values to the underlying database
itself. To change the database settings, you must change the appropriate initialization
parameters and restart the database.
Note that SQL Developer does not use default values from the current system for
globalization support parameters; instead, SQL Developer, when initially installed, by
default uses parameter values that include the following:
NLS_LANG,"AMERICAN"
NLS_TERR,"AMERICA"
NLS_CHAR,"AL32UTF8"
NLS_SORT,"BINARY"
NLS_CAL,"GREGORIAN"
NLS_DATE_LANG,"AMERICAN"
NLS_DATE_FORM,"DD-MON-RR"
Database: Reports
The Reports pane specifies options relating to SQL Developer Reports.
Close all reports on disconnect: If this option is checked, all reports for any database
connection are automatically closed when that connection is disconnected.
To find a specific third-party JDBC driver, see the appropriate Web site (for example,
http://www.mysql.com for the MySQL Connector/J JDBC driver for MySQL,
http://jtds.sourceforge.net/ for the jTDS driver for Microsoft SQL Server
and Sybase Adaptive Server, or
http://www.teradata.com/DownloadCenter/Forum54-1.aspx for the JDBC
driver for Teradata). For MySQL, use the MySQL 5.0 driver, not 5.1 or later, with SQL
Developer release 1.5.
You must specify a third-party JDBC driver or install a driver using the Check for
Updates feature before you can create a database connection to a third-party database
of that associated type. (See the tabs for creating connections to third-party databases
in the Create/Edit/Select Database Connection dialog box.)
Database: Worksheet
The Worksheet pane specifies options that affect the behavior of the SQL Worksheet.
Autocommit in SQL Worksheet: If this option is checked, a commit operation is
automatically performed after each INSERT, UPDATE, or DELETE statement executed
using the SQL Worksheet. If this option is not checked, a commit operation is not
performed until you execute a COMMIT statement.
Open a worksheet on connect: If this option is checked, a SQL Worksheet window for
the connection is automatically opened when you open a database connection. If this
option is not checked, you must use the Open SQL Worksheet right-click command or
toolbar icon to open a SQL Worksheet.
Close all worksheets on disconnect: If this option is checked, all SQL Worksheet
windows for any database connection are automatically closed when that connection
is disconnected.
Prompt for Save File on Close: If this option is checked, you are prompted to save
changes when you close a SQL Worksheet if it contains any unsaved changes. If this
option is not checked, any unsaved changes are discarded.
Max rows to print in a script: Limits the number of rows displayed.
SQL History Limit: Maximum number of statements that can be stored in the SQL
History. Must be greater than 0 (zero). If you enter an invalid value, no value is stored
in this field.
Default path to look for scripts: The default directory where SQL Developer looks
when you run a script (using @). If you type a path, you can specify multiple delimited
locations; if you click Browse, you can select a single location. In addition to any path
that you specify, SQL Developer looks in the location specified by the SQLPATH
environment variable.
Save bind variables to disk on exit: If this option is checked, bind variables that you
enter when running a script are saved on disk for reuse. If you do not want bind
variable values stored on disk (for security or other reasons), be sure not to check this
option.
1.12.5 Debugger
The Debugger pane contains general options for the SQL Developer debugger. Other
panes contain additional specific kinds of debugger options.
Debugger: Breakpoints
The Breakpoints pane sets the columns to appear in the Breakpoints pane and the
scope of each breakpoint.
Debugger: Data
The Data pane enables you to control the columns to appear in the debugger Data
pane and aspects of how the data is displayed.
Debugger: Inspector
The Inspector pane enables you to control the columns to appear in the debugger
Inspector pane and aspects of how the data is displayed.
Debugger: Stack
The Stack pane enables you to control the columns to appear in the debugger Stack
pane and other options.
Debugger: ToolTip
The ToolTip pane enables you to control the columns to appear in the debugger
ToolTip pane.
Debugger: Watches
The Watches pane enables you to control the columns to appear in the debugger
Watches pane and aspects of how the data is displayed.
1.12.6 Extensions
The Extensions pane determines which optional extensions SQL Developer uses when
it starts. (SQL Developer also uses some mandatory extensions, which users cannot
remove or disable.) If you change any settings, you must exit SQL Developer and
restart it for the new settings to take effect.
For Versioning Support, the settings (selected or not, and configuration options if
selected) affect whether the Versioning menu is displayed and the items on that menu.
Extensions to Use: Controls the specific optional SQL Developer extensions to use at
startup.
Check for Updates: Checks for any updates to the selected optional SQL Developer
extensions, as well as any mandatory extensions. (If the system you are using is behind
a firewall, see the SQL Developer user preferences for Web Browser and Proxy.)
Automatically Check for Updates: If this option is checked, SQL Developer
automatically checks for any updates to the selected optional SQL Developer
extensions and any mandatory extensions at startup.
This overrides any previous application association that may have been in effect for
that file extension.
To add a file extension, click Add and specify the file extension (including the period).
After adding the extension, you can modify its associated information by selecting it
and using the Details area.
1.12.10 Migration
The Migration pane contains options that affect the behavior of SQL Developer when
you migrate schema objects and data from third-party databases to an Oracle
database.
Default Repository: Migration repository to be used for storing the captured models
and converted models. For information about migrating third-party databases to
Oracle, including how to create a migration repository, see Chapter 2.
specifying \N for null or \\ for \). For information about the mysqldump
command, see Section 2.9.1.3, "Creating Data Files From MySQL".
For MySQL offline migrations, the data is exported to a file named table-name.txt;
so if you are moving data from two or more tables with the same name but in
different schemas, rename files as needed so that they are all unique, and modify
the SQL*Loader .ctl file accordingly.
Online: The online data move options determine the results of files created when you
click Migration, then Migrate Data.
Number of Parallel Data Move Streams: The number of internal connections created
for simultaneous movement of data from the source database to the Oracle tables.
Higher values may shorten the total time required, but will use more database
resources during that time.
Number of Rows to Commit After: During the data move operation, Oracle pauses to
perform an automatic internal commit operation after each number of rows that you
specify are moved from the source database to Oracle tables.
Lower values will cause a successful move operation to take more time; but if a failure
occurs, it is likely that more source records will exist in the Oracle tables and that if the
move operation is resumed, fewer source records will need to be moved. Higher
values will cause a successful move operation to take less time; but if a failure occurs,
it is likely that fewer source records will exist in the Oracle tables and that is the move
operation is resumed, more source records will need to be moved.
Offline: The offline data move options determine the results of files created when you
click Migration, then Generate Scripts, then Generate Data Move Scripts.
Offline Data Script Directory: Default location for scripts for offline data move
operations.
End of Column Delimiter: String to indicate end of column.
End of Row Delimiter: String to indicate end of row.
Date Mask: Format mask for dates.
Timestamp Mask: Format mask for timestamps.
Migration: Translators
The Translators pane contains options that relate to conversion of stored procedures
and functions from their source database format to Oracle format. (These options
apply only to migrations from Microsoft Access, Microsoft SQL Server, and Sybase
Adaptive Server.)
Default Source Date Format: Default date format mask to be used when casting string
literals to dates in stored procedures and functions.
Query Assignment Translation: Option to determine what is generated for a query
assignment: only the assignment, assignment with exception handling logic, or
assignment using a cursor LOOP ... END LOOP structure to fetch each row of the
query into variables.
1.12.14 Versioning
Versioning preferences affect the behavior of the version control and management
systems that you can use with SQL Developer. You can specify preferences for CVS
and Subversion. For information about using versioning with SQL Developer, see
Section 1.10, "Using Versioning".
Versioning: CVS
The CVS pane specifies options for use with CVS (Concurrent Versions System).
CVS Client: Internal to Oracle SQL Developer (installed with SQL Developer) or
External Executable (separately installed CVS client, for which you must specify the
name or path).
■ Name on System Path: Name of the CVS server executable. The default (cvs) is
correct for most installations. This option assumes that the name of the CVS server
executable is on the system path.
■ Path from Environment: Location of the CVS server executable, especially if there
is more than one on the system path. The selection area will list all instances of the
CVS server executable known to the local system. You may have more than one
version of CVS installed: this option lets you specify which of them to use with
SQL Developer.
■ Other Path: Location of the CVS server executable, if it is not on the system path at
all.
Run CVS in Edit/Watch Mode: If this option is enabled, you coordinate access to files
by declaring an editor for them through CVS, after which they may be modified. Only
those files that you check out after changing this preference will be affected. If this
option is disabled, the edit and watch commands on the Versioning menu are disabled.
State Overlay Scheme: Scheme for the icons displayed alongside folder and file names
in the navigators to indicate their versioning status.
Global Options: Encrypt: If this option is enabled, all communication between the
client and the server is encrypted. Encryption support is not available in CVS by
default; it must be enabled using a special configuration option when you build CVS.
Set Compression Level (z): If this option is enabled, you can set the compression level
for files sent between client and server. The level can be set from Minimum (high
speed, low compression) to Maximum (low speed, high compression).
Keyword Substitution Mode: CVS uses keyword substitution modes to insert revision
information into files when they are checked out or updated. This option controls the
mode of replacement for keyword substitution in versioned files:
■ Automatic: The default, recommended option.
■ Keyword-Only Mode: Generates only keyword names in keyword strings and
omits their values. This option is useful for disregarding differences due to
keyword substitution when comparing different revisions of a file.
■ Keyword-Value Mode: Generates keyword strings using the default form.
■ Keyword-Value-Locker Mode: Like the keyword-value mode, except that the
name of the locker is always inserted if the given revision is currently locked.
■ Old-Contents Mode: Generates the old keyword string, present in the working file
just before it was checked in.
■ Value-Only Mode: Generates only keyword values for keyword strings. This can
help generate files in programming languages where it is hard to strip keyword
delimiters from a string. However, further keyword substitution cannot be
performed once the keyword names are removed, so this option should be used
with care.
On Commit: Use Comment Templates: If this option is enabled, your commit
comments will be entered through template forms. The forms are set up by the CVS
system administrator. There may be different forms for different circumstances and
installations, and it may be that none of them are suitable for your commit comments.
In this case, this preference lets you disable the use of all forms.
On Commit: Automatically Add Files: If this option is enabled, local files are added to
the CVS repository whenever you perform a commit action.
Create Backup Files on Remove: If this option is enabled, backup copies are made of
files that are removed through actions of the source control system.
Versioning: Subversion
The Subversion pane specifies the Subversion client to use with SQL Developer.
You can add, edit, and remove comment templates, and you can export templates to
an XML file or import templates that had previously been exported.
If you want to prevent other users from accessing your user-specific SQL Developer
information, you must ensure that the appropriate permissions are set on the directory
where that information is stored or on a directory above it in the path hierarchy. For
example, on a Windows system you may want to ensure that the SQL Developer
folder and the \<user-name>\Application Data\SQL Developer folder under
Documents and Settings are not shareable; and on a Linux or Mac OS X system
you may want to ensure that the ~/.sqldeveloper directory is not world-readable.
To view the SQL History in the SQL Worksheet, press F8 or click View, then History.
To restore the SQL Developer window to its original display, double-click the tab
again.
Migration is the process of copying the schema objects and data from a source
third-party (non-Oracle) database, such as MySQL, Microsoft SQL Server, Sybase
Adaptive Server, Microsoft Access, or IBM DB2 (UDB), to an Oracle database. You can
perform the migration in an efficient, largely automated way.
Thus, you have two options for working with third-party databases in SQL Developer:
■ Creating database connections so that you can view schema objects and data in
these databases
■ Migrating these databases to Oracle, to take advantage of the full range of Oracle
Database features and capabilities
This chapter contains the following major sections:
Section 2.1, "Migration Quick Start"
Section 2.2, "Overview of Migration"
Section 2.3, "Preparing a Migration Plan"
Section 2.4, "Before You Start Migrating: General Information"
Section 2.5, "Before You Start Migrating: Source-Specific Information"
Section 2.6, "Capturing the Source Database"
Section 2.7, "Creating and Customizing the Converted Model"
Section 2.8, "Generating the DDL for the Oracle Schema Objects"
Section 2.9, "Migrating the Data"
Section 2.10, "Making Queries Case Insensitive"
Section 2.11, "Testing the Oracle Database"
Section 2.12, "Deploying the Oracle Database"
Section 2.13, "Using Migration Reports"
Section 2.14, "SQL Developer User Interface for Migration"
There are two mechanisms for migrating third-party databases to Oracle: standard
migration and quick migration.
2. For Source Connection, select the connection for the third-party database to be
migrated. For example: Sales_Access
3. For Target Connection, select the connection for the Oracle Database schema to
which the third-party database is to be migrated. For example: Sales_Oracle
4. For Repository, use the selected existing repository; or if no repository exists,
allow SQL Developer to create a migration repository in the schema of the target
connection.
5. Click Verify to start the pre-migration check.
6. After the pre-migration check completes satisfactorily, specify the Migration
Type: Migrate Tables, Migrate Tables and Data, or Migrate Everything (all
objects).
7. Click Finish in the Summary pane to perform the migration.
The specific operations performed depend on the migration type and the type of
third-party database being migrated. For example, for a Microsoft Access
database, the Exporter for Microsoft Access tool is automatically invoked. Do not
interrupt any of the migration operations.
If any issues arise during the migration, the quick migration will stop. To proceed with
migration, follow the Standard Migration approach, which will help identify the issues
and allow you to modify the appropriate objects.
Source
Database
Migration
Repository
Captured
SQL Developer Model
Converted
Model
Destination
Oracle
Schema
There are several choices you must make about the third-party database and
applications that access that database in order to define the scope of the migration
project. To obtain a list of migration issues and dependencies, you should consider
the following
■ What third-party databases are you migrating?
– What is the version of the third-party database?
– What is the character set of the third-party database?
■ What source applications are affected by migrating the third-party database to
an Oracle database?
– What is the third-party application language?
– What version of the application language are you using?
In the scope of the project, you should have identified the applications you
must migrate. Ensure that you have included all the necessary applications
that are affected by migrating the database
■ What types of connectivity issues are involved in migrating to an Oracle
database?
– Do you use connectivity software to connect the applications to the
third-party database? Do you need to modify the connectivity software to
connect the applications to the Oracle database?
– What version of the connectivity software do you use? Can you use this
same version to connect to the Oracle database?
■ Are you planning to rewrite the applications or modify the applications to
work with an Oracle database?
2. Use Table 2–1 to determine whether you have a complex or simple source database
environment. Identify the requirements based on the specific scenario.
If the migration project is a simple scenario, you may not have to complete all of
the tasks listed in this guide. You make decisions based on your specific
environment. For example, if you have a complex scenario, you may require extra
testing based on the complexity of the application accessing the database.
After you have solved a complex problem, it should be easier and quicker to
resolve the next time you have the same problem.
Roles
CONNECT WITH ADMIN OPTION
RESOURCE WITH ADMIN OPTION
Privileges
ALTER ANY ROLE
ALTER ANY SEQUENCE
For example, you can create a user called migrations with the minimum required
privileges required to migrate a database by using the following commands:
CREATE USER migrations IDENTIFIED BY password
DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
GRANT ALTER ANY ROLE, ALTER ANY SEQUENCE, ALTER ANY TABLE, ALTER TABLESPACE,
ALTER ANY TRIGGER, COMMENT ANY TABLE, CREATE ANY SEQUENCE, CREATE ANY TABLE,
CREATE ANY TRIGGER, CREATE ROLE, CREATE TABLESPACE, CREATE USER, DROP ANY
SEQUENCE, DROP ANY TABLE, DROP ANY TRIGGER, DROP TABLESPACE, DROP USER, DROP ANY
ROLE, GRANT ANY ROLE, INSERT ANY TABLE, SELECT ANY TABLE, UPDATE ANY TABLE TO
migrations;
After you have created the converted model is created and done first DDL generation
done for the new database, it will be clear from the scripts which privileges will be
required for your situation.
1. Ensure that the source database is accessible by the IBM DB2 database user that is
used by SQL Developer for the source connection. This user must be able to see
any objects to be captured in the IBM DB2 database; objects that the user cannot
see are not captured. For example, if the user can execute a stored procedure but
does not have sufficient privileges to see the source code, the stored procedure
cannot be captured.
2. Ensure that you can connect to the IBM DB2 database from the system where you
have installed SQL Developer.
3. Ensure that you have downloaded the db2jcc.jar and db2jcc_license_
cu.jar files from IBM.
4. In SQL Developer, do the following:
a. Click Tools, then Preferences, then Database, then Third Party JDBC Drivers.
b. Click Add Entry.
c. Select the db2jcc.jar file.
d. Click OK.
e. Repeat steps b through d for the db2jcc_license_cu.jar file.
2.5.2 Before Migrating From Microsoft SQL Server or Sybase Adaptive Server
To configure a Microsoft SQL Server or Sybase Adaptive Server database for
migration:
1. Ensure that the source database is accessible by the Microsoft SQL Server or
Sybase Adaptive Server user that is used by SQL Developer for the source
connection. This user must be able to see any objects to be captured in the
Microsoft SQL Server or Sybase Adaptive Server database; objects that the user
cannot see are not captured. For example, if the user can execute a stored
procedure but does not have sufficient privileges to see the source code, the stored
procedure cannot be captured.
2. Ensure that you can connect to the Microsoft SQL Server or Sybase Adaptive
Server database from the system where you have installed SQL Developer.
3. Ensure that you have downloaded the JTDS JDBC driver from
http://jtds.sourceforge.net/.
4. In SQL Developer, if you have not already installed the JTDS driver using Check
for Updates (on the Help menu), do the following:
a. Click Tools, then Preferences, then Database, then Third Party JDBC Drivers.
b. Click Add Entry.
c. Select the jar file for the JTDS driver you downloaded from
http://jtds.sourceforge.net/.
d. Click OK.
5. In SQL Developer, click Tools, then Preferences, then Migration: Identifier
Options, and ensure that the setting is correct for the Is Quoted Identifier On
option (that is, the setting reflects the database to be migrated).
If this option is enabled, quotation marks (double-quotes) can be used to refer to
identifiers; if this option is not enabled, quotation marks identify string literals. As
an example of the difference in behavior, consider the following T-SQL code:
select col1, "col 2" "column_alias"
From the Tools menu in Microsoft Access 97, select Add Ins, then select Linked
Table Manager.
From the Tools menu in Microsoft Access 2000, select Database Utilities, then
select Linked Table Manager.
6. Ensure that the Microsoft Access database is not a replica database, but a master
database.
When you use the Exporter for Microsoft Access to export, an error message is
displayed if the database is a replica. SQL Developer does not support the
migration of a replica database.
7. From the Tools menu within Microsoft Access, select Database, then select
Compact Database to compact the Microsoft Access database files.
8. Ensure that the Microsoft Access MDB file is accessible from the system where you
have installed SQL Developer.
9. Use the Oracle Universal Installer to verify that you have the Oracle ODBC driver
installed. If you need to install the driver, it is available on the Oracle Database
Server or Database Client CD. You can also download the Oracle ODBC driver
from the Oracle Technology Network (OTN) Web site:
http://www.oracle.com/technology/software/tech/windows/odbc/
Install the Oracle ODBC driver into an Oracle home directory that contains the
Oracle Net Services. You can obtain the Oracle Net Services from the Oracle Client
or Oracle Database CD. You install Oracle Net Services to obtain the Net
Configuration Assistant and Net Manager. These allow you to create a net
configuration in the tnsnames.ora file.
Note: Do not modify any of the files created by the Exporter tool.
Each Microsoft Access database that you selected is exported to an XML file. The
exporter tool currently does not support creating XML files from secured or replica
databases.
2. Ensure that you have downloaded the MySQLConnector/J API from the MySQL
Web site at http://www.mysql.com/.
3. In SQL Developer, if you have not already installed the MySQL JDBC driver using
Check for Updates (on the Help menu), do the following:
a. Click Tools, then Preferences, then Database, then Third Party JDBC Drivers.
b. Click Add Entry.
c. Select the jar file for the MySQL driver you downloaded from
http://www.mysql.com/.
d. Click OK.
4. Ensure that the source database is accessible by the MySQL user that is used by
SQL Developer for the source connection. This user must be able to see any objects
to be captured in the MySQL database; objects that the user cannot see are not
captured. For example, if the user can execute a stored procedure but does not
have sufficient privileges to see the source code, the stored procedure cannot be
captured.
Note: Oracle recommends that you do not change the default data
type mappings unless you are an experienced Oracle database
administrator.
prompt you for the database name, user name, and password, and they use this
information to connect to the local DB2 database. The scripts generate the schema
dump for database objects within object-specific folders.
To capture the schema information in offline file format, use a command in the
following format (with the db2 executable in the run path):
db2 -x +o -r <file name> <schema query>
To export the schema data in offline file format, use a command in the following
format (with the db2 executable in the run path):
■ For DB2 version 9 data export:
db2 export to <file name> of DEL modified by lobsinsepfiles coldel"#"
timestampformat=\"YYYY/MM/DD HH.mm.ss\" datesiso nochardel <select query>
DB2 version 9 supports LOB data in separate files, which is better for migrating large
data sizes. With version 8, to support large LOB data, you must modify the oracle ctl
file command and db2 command in unload_script.bat or unload_script.sh.
The table data is exported to files with names in the format
<catalog>.<schema>.<table>.dat. The format of file is as follows: data1#<COL_DEL>
#data2#<COL_DEL>…<ROW_DEL> where COL_DEL and ROW_DEL come from
migration offline preference settings.
Before you execute the DB2 data dump script, you must log in by entering a command
in the following format:
db2 connect to <catalog> user <user name> using <password>
You can then execute the script using the logged connection session.
■ Run the data unload scripts to create data files from the source database using the
appropriate procedure for your source database:
– Creating Data Files From Microsoft SQL Server or Sybase Adaptive Server
– Creating Data Files From Microsoft Access
– Creating Data Files From MySQL
– For IBM DB2, see the chapter about offline data loading in Oracle SQL
Developer Supplementary Information for IBM DB2 Migrations.
– For Teradata, perform the offline data move using BTEQ and SQL*Loader.
■ Run the data load scripts using SQL*Loader to populate the destination database
with the data from these data files as described in Section 2.9.1.4.
2.9.1.1 Creating Data Files From Microsoft SQL Server or Sybase Adaptive Server
To create data files from a Microsoft SQL Server or Sybase Adaptive Server database:
1. Copy the contents of the directory where SQL Developer generated the data
unload scripts onto the computer where the source database is installed.
2. Edit the BCP extract script to include the name of the source database server.
■ On Windows, edit the unload_script.bat script to alter the bcp lines to
include the appropriate variables.
The following shows a line from a sample unload_script.bat script:
bcp "AdventureWorks.dbo.AWBuildVersion" out
"[AdventureWorks].[dbo].[AWBuildVersion].dat" -q -c -t "<EOFD>" -r "<EORD>"
-U<Username> -P<Password> -S<ServerName>
2. Edit the unload_script script to include the correct host, user name, password,
and destination directory for the data files.
■ On Windows, edit the unload_script.bat script.
■ On Linux or UNIX, edit the unload_script.sh script.
The following shows a line from a sample unload_script.bat script:
mysqldump -h localhost -u <USERNAME> -p<PASSWORD> -T <DESTINATION_PATH>
--fields-terminated-by="<EOFD>" --fields-escaped-by=""
--lines-terminated-by="<EORD>" "CarrierDb" "CarrierPlanTb"
Edit this line to include the correct values for USERNAME, PASSWORD, and
DESTINATION PATH. Do not include the angle brackets in the edited version of
this file.
In this command line, localhost indicates a loopback connection, which is
required by the -T option. (See the mysqldump documentation for more
information.)
3. Run the script.
■ On Windows, enter:
prompt> unload_script.bat
For Microsoft SQL Server and Sybase migrations, if you are inserting into BLOB fields
with SQL*Loader, you will receive the following error:
SQL*Loader-309: No SQL string allowed as part of LARGEOBJECT field specification
To handle situations indicated by this error, you can use either one of the following
options:
■ Enable the Generate Stored Procedure for Migrate Blobs Offline SQL Developer
preference (see Migration: Generation Options).
■ Use the following Workaround.
Workaround
The workaround is to load the data (which is in hex format) into an additional CLOB
field and then convert the CLOB to a BLOB through a PL/SQL procedure.
The only way to export binary data properly through the Microsoft SQL Server or
Sybase Adaptive Server BCP is to export it in a hexadecimal (hex) format; however, to
get the hex values into Oracle, save them in a CLOB (holds text) column, and then
convert the hex values to binary values and insert them into the BLOB column. The
problem here is that the HEXTORAW function in Oracle only converts a maximum of
2000 hex pairs. Consequently, write your own procedure that will convert (piece by
piece) your hex data to binary. (In the following steps and examples, modify the
START.SQL and FINISH.SQL to reflect your environment.
The following shows the code for two scripts, start.sql and finish.sql, that
implement this workaround. Read the comments in the code, and modify any SQL
statements as needed to reflect your environment and your needs.
Note: After you run start.sql and before you run finish.sql,
run BCP; and before you run BCP, change the relevant line in the
.ctl file from:
<blob_column> CHAR(2000000) "HEXTORAW (:<blob_column>)"
to:
<blob_column>_CLOB CHAR(2000000)
-- START.SQL
-- Modify this for your environment.
-- This should be executed in the user schema in Oracle that contains the table.
-- DESCRIPTION:
-- ALTERS THE OFFENDING TABLE SO THAT THE DATA MOVE CAN BE EXECUTED
-- DISABLES TRIGGERS, INDEXES AND SEQUENCES ON THE OFFENDING TABLE
tablespace);
COMMIT;
-- END OF FILE
-- FINISH.SQL
-- Modify this for your enironment.
COMMIT;
cur_rec cur%ROWTYPE;
BEGIN
OPEN cur;
FETCH cur INTO cur_rec;
WHILE cur%FOUND
LOOP
--RETRIVE THE clobLoc and blobLoc
clobLoc := cur_rec.clob_column;
blobLoc := cur_rec.blob_column;
LOOP
-- get the next piece and add it to the clob
piece := DBMS_LOB.subStr(clobLoc,pieceMaxSize,currentPlace);
END CLOBtoBLOB;
/
COMMIT;
-- END OF FILE
If you want queries to be case insensitive for a user in the Oracle database, you can
create an AFTER LOGON ON DATABASE trigger, in which you set, for that database
user, the NLS_SORT session parameter to an Oracle sort name with _CI (for "case
insensitive") appended.
The following example causes queries for user SMITH to use the German sort order
and to be case insensitive:
CREATE OR REPLACE TRIGGER set_sort_order AFTER LOGON ON DATABASE
DECLARE
username VARCHAR2(30);
BEGIN
username:=SYS_CONTEXT('USERENV','SESSION_USER');
IF username LIKE 'SMITH' then
execute immediate 'alter session set NLS_COMP=LINGUISTIC';
execute immediate 'alter session set NLS_SORT=GERMAN_CI';
END IF;
END;
Note: The tests that you run against the application vary
depending on the scope of the application. Oracle recommends that
you thoroughly test each SQL statement that is changed in the
application. You should also test the system to make sure that the
application functions the same way as in the third-party database.
There are several types of tests that you use during the migration process. During the
testing stage, you go through several cycles of testing to enhance the quality of the
database. The test cases you use should make sure that any issues encountered in a
previous version of the Oracle database are not introduced again.
For example, if you have to make changes to the migrated schema based on test
results, you may need to create a new version of the Oracle database schema. In
practice, you use SQL Developer to create a base-line Oracle schema at the start of
testing, and then edit this schema as you progress with testing.
Note: Oracle recommends that you track issues that you find
during a testing cycle in an issue tracking system. Track these
issues against the version of the database or application that you
are testing.
This procedure explains one way of testing the migrated database. Other methods are
available and may be more appropriate to your business requirements.
To test the Oracle database:
1. Create a controlled version of the migrated database.
Oracle recommends that you keep the database migration scripts in a source
control system.
2. Design a set of test cases that you can use to test the Oracle database from unit to
system level. The test cases should:
a. Ensure the following:
– All the users in the source database have migrated successfully
– Privileges and grants for users are correct
– Tables have the correct structure, defaults are functioning correctly, and
errors did not occur during mapping or generation
approach may affect the work of the users you migrated. However, because the
number of users is limited, support services are not overloaded with issues.
The Phased approach allows you to debug scalability issues as the number of migrated
users increases. However, using this approach may mean that you must migrate data
to and from legacy systems during the migration process. The application architecture
must support a phased approach.
Aside from the Oracle software that allows you to create an Oracle database, you
may need to install ancillary software to support the application, such as Extract
Transformation and Load (ETL) Software for data warehousing.
4. Create the destination database from the source database and migrate the data to
the Oracle database.
There are several ways of putting the destination database into production after
testing it, such as:
■ Place the successfully tested database into production. The test system is now
the production system.
■ Use Oracle Export to extract the destination database from the successfully
tested database and use Oracle Import to create that database within the
production environment.
■ Use the tested migration scripts to create the Oracle database and populate it
with data using SQL*Loader.
5. Perform the final checks on the destination database and applications.
6. Place the destination database into production using one of the rollout strategies.
7. Perform a final audit by doing the following:
■ Audit the integrity of the data
■ Audit the validity of the processes, such as back-up and recovery
■ Obtain sign-off for the project, if necessary
In this figure:
■ The Connections navigator shows three database connections: migration_
repository for a connection (to a user named MIGRATION) used for the
migration repository, sales_access connected to a Microsoft Access database
named sales.mdb, and sales_oracle connected to an Oracle user named SALES
whose schema owns the migrated schema objects.
■ The Captured Models navigator shows one captured model, which was created
using an XML file created by the exporter tool for Access applications. (If the
source database is a type other than Microsoft Access, the procedure for creating
the captured model is different: you can generate it directly from the source
database connection.)
■ The Converted Models navigator shows one converted model, which is an Oracle
representation of the source database. The converted model is created from the
captured model, and the converted model is used to generate the schema objects
that you can see using an Oracle database connection (sales_oracle in this figure).
To translate a statement to its Oracle equivalent, select the type of translation, enter the
third-party SQL statement or statements, then click the Translate (>>) icon to display
the generated PL/SQL statement or statements.
SQL keywords are automatically highlighted.
The first time you save the contents of either worksheet window in the translation
scratch editor, you are prompted for the file location and name. If you perform any
subsequent Save operations (regardless of whether you have erased or changed the
content of the window), the contents are saved to the same file. To save the contents to
a different file, click File, then Save As.
For detailed information about the worksheet windows, see Section 1.7, "Using the
SQL Worksheet".
The SQL Developer unit testing feature provides a framework for testing PL/SQL
objects, such as functions and procedures, and monitoring the results of such objects
over time. You create tests, and for each you provide information about what is to be
tested and what result is expected. The SQL Developer implementation of unit testing
is modeled on the classic and well known xUnit collection of unit test frameworks.
The unit testing feature is part of the support within the SQL Developer family of
products for major parts of the life cycle of database system development, from design
(provided by Data Modeler) to development to testing.
This chapter contains the following major sections:
Section 3.1, "Overview of Unit Testing"
Section 3.2, "SQL Developer User Interface for Unit Testing"
Section 3.3, "Unit Test Repository"
Section 3.4, "Editing and Running a Unit Test"
Section 3.5, "Using a Dynamic Value Query for Seed Data"
Section 3.6, "Using Lookups to Simplify Unit Test Creation"
Section 3.7, "Using Variable Substitution in Validation Actions"
Section 3.8, "Unit Test Library"
Section 3.9, "Unit Test Reports"
Section 3.10, "Exporting and Importing Unit Test Objects"
Section 3.11, "Using the Command-Line Interface"
Section 3.12, "Example of Unit Testing (Tutorial)"
In the preceding figure, the top-level repository node shows the name of the
connection being used (unit_test_repos) and whether the user associated with that
connection has only User access to the repository or both Administrator and User
access (here, both). (Administrator and User access are explained in Section 3.3.)
The preceding figure also shows the types of actions under the Library node (Startups,
Teardowns, Validations), one test suite, and several tests.
repository objects or for any other user that has been granted Administrator access to
the repository. The Unit Testing: Manage Users dialog box is displayed.
■ Freeze View (the pin) keeps that pane in the SQL Developer window when you
click another unit test in the Unit Test navigator; a separate tab and detail view
pane are created for that other unit test. If you click the pin again, the unit test’s
detail view pane is available for reuse.
■ Refresh refreshes the display in the pane.
■ Debug starts execution of the first or next implementation of the unit test in debug
mode, and displays the results in the Results tab.
■ Run starts normal execution of the unit test, and displays the results in the Results
tab.
■ Edit (pencil icon) enables you to edit the unit test specification. (If you cannot
modify the unit test, lick the Edit icon.)
■ Commit Changes saves any changes that you have made to the unit test.
■ Rollback Changes discards any unsaved changes that you have made to the unit
test.
If you click the Edit icon, you can modify the Startup Process, Teardown Process, and
details for each implementation.
You can also specify Gather Code Coverage Statistics to have SQL Developer collect
statistics related to code coverage. To view any statistics that have been gathered from
unit test runs, use the Test Runs Code Coverage report. In that report, you can click a
row with summary information to display detailed information in the Code Coverage
Details pane.
and teardown actions, and specify a validation action (such as a query returning rows
or no rows).
The following example assumes that you done at least the following in Section 3.12,
"Example of Unit Testing (Tutorial)": created the EMPLOYEES table, created the
AWARD_BONUS procedure, and created the unit test repository. It creates a unit test
that checks to be sure that no salesperson would receive a bonus so large that his or
her salary amount would be greater than 20000. Follow these steps:
1. Create and populate the table for the seed data by executing the following
statements:
CREATE TABLE award_bonus_dyn_query (emp_id NUMBER PRIMARY KEY, sales_amt
NUMBER);
INSERT INTO award_bonus_dyn_query VALUES (1001, 5000);
INSERT INTO award_bonus_dyn_query VALUES (1002, 6000);
INSERT INTO award_bonus_dyn_query VALUES (1003, 2000);
commit;
2. In the Unit Test navigator, right-click the Tests node and select Create Test.
The Unit Testing: Create Unit Test wizard is displayed. Click Next to go from each
step to the next; and when you are finished specifying the unit test, click Finish.
3. In Select Operation, select the database connection for the schema that you used to
create the AWARD_BONUS procedure; then expand the Procedures node and
select AWARD_BONUS.
4. In Specify Test Name, for Test Name specify AWARD_BONUS_WITH_SEED_
DATA, and select Seed/create implementations using lookup values.
(You will not actually be using lookup values in this case, but this choice enables
you to pass quickly through the remaining wizard steps before editing the unit
test to use a dynamic value query.)
5. In Specify Startup, select Table or Row Copy because you want to save the current
data values in the EMPLOYEES table before any data is modified by the unit test.
When prompted, for Source Table specify EMPLOYEES, and for Target Table
accept the default name provided for a temporary table that will be automatically
created when it is needed and deleted when it is no longer needed.
6. In Specify Parameters, click Next to go to the next page.
7. In Specify Validations, click Next to go to the next page.
8. In Specify Teardown, select Table or Row Restore because you want to restore the
original data values in the EMPLOYEES table before any data was modified by the
unit test. When prompted, accept the supplied values for Target Table
(EMPLOYEES) and Source Table (the name of the temporary table).
9. In Summary, review the information. If you need to change anything, click Back
as needed and make the changes, then proceed to this Summary page. When you
are ready to complete the unit test definition, click Finish.
10. In the Unit Test navigator, click the node for AWARD_BONUS_WITH_SEED_
DATA under Tests, to display the test in an editing window.
11. In the Details pane, click the pencil icon next to Dynamic Value Query enter the
following, and click OK:
SELECT emp_id, sales_amt FROM award_bonus_dyn_query;
13. In Specify Validations, click the plus (+) icon and select Query returning no rows.
For the query, replace the SELECT statement in the Process Validation box with
the following (any semicolon at the end of the statement is ignored):
SELECT * FROM employees WHERE salary_amt > 20000
AND commission_pct IS NOT NULL
That is, for all salespersons (employees whose commission percentage is not null),
check whether the salary resulting from the unit test run is greater than 20000. If
there are no such salespersons )that is, the query returns no rows), the result of the
validation action is success.
14. Run the AWARD_BONUS_WITH_SEED_DATA unit test. (For the basic steps to
run a unit test, see Section 3.12.5.)
a cell under Input, you can click the dropdown arrow to select a value from the
specified lookup. (You can also enter a value other than one in the list.)
For example, if you created the EMP_ID_LOOKUP lookup category as explained in
Section 3.6, and if you select it as the lookup category when specifying parameters,
then the values -100, 99, 1001, 1002, 1003, 1004, 2000, 9999, and (null) will be in the
dropdown list for the Input cell for the EMP_ID parameter. (For the SALES_AMT
parameter, use the SALES_AMT_LOOKUP category.)
procedure or function, or on the return value of a function. You can specify strings in
the following format in validation actions:
■ For input parameters: {PARAMETER_NAME}
For example, if an input parameter is named EMP_ID:
SELECT ... WHERE employee_id = {EMP_ID} AND ...;
What is actually substituted is the string representation of the parameter value. For
example:
■ If P1 is a parameter of type NUMBER and has the value 2.1, the string {P1} will
be replaced by the string 2.1.
■ If P1 is a parameter of type VARCHAR2 and has the value ABC, the string '{P1}'
will be replaced by the string 'ABC'. (Note the single-quotation marks around
{P1} in this example.)
You can use variable substitution for all types of validation actions except Compare
Tables. For the applicable validation action types, variable substitution is performed as
follows:
■ For Query Returning Row(s) and Query Returning No Row(s), substitution is
performed on the SQL query.
■ For Compare Query Results, substitution is performed on both the source and
target SQL queries.
■ For Boolean Function and User PL/SQL Code, substitution is performed on the
PL/SQL block.
a name for the action; click the name of the newly created action; and complete the
specification.
■ Use the Publish to Library option when specifying the action when you are
creating a unit test: enter a name for the action and click Publish. (The action will
be added under the appropriate category and subcategory in the Library display
in the Unit Test navigator.)
To use an action from the library when you are creating a unit test, select it from the
list under Library on the appropriate page in the Unit Testing: Create Unit Test wizard.
exists in the repository with the same name as an object of the same type in the XML
file, it is replaced (overwritten) by the object definition in the XML file.
To import unit test objects, click Tools, then Unit Test, then Import from File; then
specify the XML file to be used for the import operation.
UtUtil -run ?
UtUtil -exp ?
UtUtil -imp ?
Then enter the command for information about the command that you want to use.
For example: UtUtil -run ?
The following example runs a unit test named AWARD_BONUS in a Windows
environment where SQL Developer is installed under Program Files. (Note that test
and suite names are case sensitive for the command-line interface.) This example uses
the repository connection for user unit_test_repos and runs the test as user fred.
> cd c:\Program Files\sqldeveloper\sqldeveloper\bin
> UtUtil -run -test -name AWARD_BONUS -repo unit_test_repos -db fred
The following example exports a unit test named AWARD_BONUS. It uses the
repository connection for user unit_test_repos and stores the exported definitions in
the file C:\ut_xml\award_bonus_test.xml.
> UtUtil -exp -test -name AWARD_BONUS -repo unit_test_repos -file c:\ut_xml\award_
bonus_test.xml
The following example imports object definitions from the file C:\ut_xml\award_
bonus_suite.xml. It uses the repository connection for user unit_test_repos.
> UtUtil -imp -repo unit_test_repos -file c:\ut_xml\award_bonus_suite.xml
To check the results of any tests or suites that you run from the command line, you can
start SQL Developer and view the All Test Runs and All Suite Runs reports (see
Section 3.9, "Unit Test Reports").
The EMPLOYEES table includes the following columns, all of type NUMBER:
■ EMPLOYEE_ID: Employee identification (badge) number.
■ COMMISSION_PCT: Commission percentage for the employee: a decimal fraction
representing the percentage of the amount of sales by the employee, to be used to
compute a bonus that will be added to the employee’s base salary to determine the
total salary. For example, 0.2 or .2 indicates a 20 percent commission, or 0.2 times
the amount of sales.
Only employees in the Sales department have numeric COMMISSION_PCT
values. Other employees (not "on commission") have null COMMISSION_PCT
values.
■ SALARY: Salary amount for the employee; includes base salary plus any bonus
(which will be calculated by an award_bonus procedure, to be created during
this example).
Assume that the following data exists in these columns in the EMPLOYEES table:
You create a procedure named AWARD_BONUS, which has two input parameters:
■ emp_id: The employee ID of an employee.
■ sales_amt: The amount of sales with which the employee is credited for the
period in question.
This amount is calculated using the COMMISSION_PCT value for the specified
employee, and the result is added to the SALARY value for that employee.
If the COMMISSION_PCT is null for the employee, no commission or bonus can
be calculated, and an exception is raised. This scenario occurs if an attempt is
made to add a commission-based bonus to the salary of an employee who is not in
the Sales department.
The rest of this example involves the following major steps:
1. Create the EMPLOYEES Table.
2. Create the AWARD_BONUS Procedure.
3. Create the Unit Testing Repository.
Click the Run Script icon (or press F5) to create the AWARD_BONUS procedure.
table will be created; and if a table already exists with the name that you specify as
the target table, it will be overwritten.)
5. In Specify Parameters, change the values in the Input column to the following:
For Parameter EMP_ID: 1001
For Parameter SALES_AMT: 5000
For Expected Result, leave the value as Success.
6. In Specify Validations, click the plus (+) icon and select Query returning row(s).
For the query, replace the SELECT statement in the Process Validation box with
the following (any semicolon at the end of the statement is ignored):
SELECT * FROM employees
WHERE employee_id = 1001 AND salary = 9400
That is, because employee 1001 has a 20 percent (0.2) commission and because the
sales amount was specified as 5000, the bonus is 1000 (5000 * 0.2), and the new
salary for this employee is 9400 (8400 base salary plus 1000 bonus). In this case, the
query returns one row, and therefore the result of the validation action is success.
Note that you could have instead specified the SELECT statement in this step
using variable replacement (explained in Section 3.7), as follows:
SELECT * FROM employees
WHERE employee_id = {EMP_ID} AND salary = 9400
If you want to check the EMPLOYEES table data, you will see that the salary for
employee 1001 is the same as it was before (8400), because the startup action for the
unit test copied the original data to the temporary table and the teardown action
restored the original data to the EMPLOYEES table.
2. In the Details tab, near the top-right corner, select the database connection for the
schema that you used to create the AWARD_BONUS procedure.
Do not change any other values. (However, if you later want to run the unit test
suite with different specifications, you can click the Edit (pencil) icon in the Code
Editor toolbar at the top of the pane.)
3. Click the Run Suite (green arrowhead) icon in the Code Editor toolbar (or press
F9).
After the suite is run, focus is shifted to the Results tab, where you can soon see that
the AWARD_BONUS_SUITE test suite ran successfully.
In this tutorial, you will use SQL Developer to create objects for a simplified library
database, which will include tables for books, patrons (people who have library cards),
and transactions (checking a book out, returning a book, and so on).
The tables are deliberately oversimplified for this tutorial. They would not be
adequate for any actual public or organizational library. For example, this library
contains only books (not magazines, journals, or other document formats), and it can
contain no more than one copy of any book.
You will perform the following major steps:
1. Create a Table (BOOKS).
2. Create a Table (PATRONS).
3. Create a Table (TRANSACTIONS).
4. Create a Sequence.
5. Insert Data into the Tables.
6. Create a View.
7. Create a PL/SQL Procedure.
8. Debug a PL/SQL Procedure (optional).
9. Use the SQL Worksheet for Queries (optional).
Note: To delete the objects that you create for this tutorial, you can
use the DROP statements at the beginning of the script in Section 4.10,
"Script for Creating and Using the Library Tutorial Objects".
Related Topics
Section 4.10, "Script for Creating and Using the Library Tutorial Objects"
Chapter 1, "SQL Developer Concepts and Usage"
Section 1.2, "SQL Developer User Interface"
After you have entered the last column (rating), check Advanced (next to Schema).
This displays a pane for more table options. For this table, you will use the Unique
Constraints and Check Constraints panes.
Create most of the table columns using the following information. After creating each
column except the city_state_zip column, click Add Column to add the next column.
(If you accidentally click OK instead of Add Column, right-click the PATRONS table
in the Connections navigator display, select Edit, and continue to add columns.)
The last column in the table (location) requires a complex data type, for which you
must use the Columns tab with advanced options. Check Advanced (next to Schema).
This displays a pane for selecting more table options.
In the Columns pane, click the city_state_zip column name, and click the Add Column
(+) icon to add the following as the last column in the table.
After you have entered the last column (location), click OK to finish creating the table.
Go to Section 4.3, "Create a Table (TRANSACTIONS)" to create the next table.
following information. (If a tab or field is not mentioned, do not enter anything for it.
Be sure that the Advanced box is not checked when you start creating the table.)
Schema: Specify your current schema as the schema in which to create the table.
Name: TRANSACTIONS
Create the table columns using the following information. After creating each column
except the last one (transaction_type), click Add Column to add the next column. (If
you accidentally click OK instead of Add Column, right-click the TRANSACTIONS
table in the Connections navigator display, select Edit, and continue to add columns.)
After you have entered the last column (transaction_type), check Advanced (next to
Schema). This displays a pane for selecting more table options. For this table, you will
use the Column Sequences and Foreign Keys panes.
After creating the sequence, you can use it in INSERT statements to generate unique
numeric values. The following example uses the patron_id_seq sequence in creating a
row for a new patron (library user), assigning her a patron ID that is the next available
value of the patron_id_seq sequence:
INSERT INTO patrons VALUES (patron_id_seq.nextval,
'Smith', 'Jane', '123 Main Street', 'Mytown, MA 01234', null);
To create the sequence, if you are not already connected, connect to the database as the
user for the schema you are using for this tutorial. Right-click the Sequences node in
the schema hierarchy on the left side, select New Sequence, and enter information
using the Create Sequence dialog box.
Schema: Specify your current schema as the schema in which to create the sequence.
Name: patron_id_seq
Increment: 1
Start with: 100
Min value: 100
Click OK to finish creating the sequence.
To insert sample data into the tables, go to Section 4.5, "Insert Data into the Tables".
DDL
Review the SQL statement that SQL Developer will use to create the view. If you want
to make any changes, go back to the SQL Query tab and make the changes there.
If you want to save the CREATE VIEW statement to a SQL script file, click Save and
specify the location and file name.
When you are finished, click OK.
You have finished creating the view. If you inserted data to the underlying tables, as
described in Section 4.5, "Insert Data into the Tables", you can see the data returned by
this view as follows: in the Connections navigator, expand Views, and select
PATRONS_TRANS_VIEW, then click the Data tab.
To create a procedure that lists all books with a specified rating, go to Section 4.7,
"Create a PL/SQL Procedure".
To create the procedure, if you are not already connected, connect to the database as
the user for the schema you are using for this tutorial. Right-click the Procedures node
in the schema hierarchy on the left side, select New Procedure, and enter the following
information using the Create PL/SQL Procedure dialog box.
Object Name: list_a_rating
Click OK. A source window for the new procedure is opened. Enter (or copy and
paste) the following procedure text, replacing any existing text:
CREATE OR REPLACE
PROCEDURE list_a_rating(in_rating IN NUMBER) AS
matching_title VARCHAR2(50);
TYPE my_cursor IS REF CURSOR;
the_cursor my_cursor;
BEGIN
OPEN the_cursor
FOR 'SELECT title
FROM books
WHERE rating = :in_rating'
USING in_rating;
DBMS_OUTPUT.PUT_LINE('All books with a rating of ' || in_rating || ':');
LOOP
FETCH the_cursor INTO matching_title;
EXIT WHEN the_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(matching_title);
END LOOP;
CLOSE the_cursor;
END list_a_rating;
This procedure uses a cursor (named the_cursor) to return only rows where the book
has the specified rating (in_rating parameter), and uses a loop to output the title of
each book with that rating.
Click the Save icon to save the procedure.
As a usage example, after creating the procedure named LIST_A_RATING, if you have
inserted data into the BOOKS table (for example, using the INSERT statements in
Section 4.5, "Insert Data into the Tables"), you could use the following statement to
return all books with a rating of 10:
CALL list_a_rating(10);
To create this procedure, if you are not already connected, connect to the database as
the user for the schema you are using for this tutorial. Right-click the Procedures node
in the schema hierarchy on the left side, select New Procedure, and enter the following
information using the Create PL/SQL Procedure dialog box.
Object Name: list_a_rating2
Click OK. A source window for the new procedure is opened. Enter (or copy and
paste) the following procedure text, replacing any existing text:
CREATE OR REPLACE
PROCEDURE list_a_rating2(in_rating IN NUMBER) AS
matching_title VARCHAR2(50);
matching_rating NUMBER;
TYPE my_cursor IS REF CURSOR;
the_cursor my_cursor;
rating_cursor my_cursor;
BEGIN
OPEN the_cursor
FOR 'SELECT title
FROM books
WHERE rating <= :in_rating'
USING in_rating;
OPEN rating_cursor FOR 'SELECT rating FROM books WHERE
rating <= :in_rating' USING in_rating;
DBMS_OUTPUT.PUT_LINE('All books with a rating of ' || in_rating || ':');
LOOP
FETCH the_cursor INTO matching_title;
FETCH rating_cursor INTO matching_rating;
EXIT WHEN the_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(matching_title);
END LOOP;
CLOSE the_cursor;
CLOSE rating_cursor;
END list_a_rating2;
This procedure contains a logic error in the definition of the_cursor: it selects titles
where the rating is less than or equal to a specified rating, whereas it should select
titles only where the rating is equal to the specified rating.
Click the Save icon to save the procedure.
Assume that you wanted to run this procedure and list all books with a rating of 10.
Right-click LIST_A_RATING2 in the Connections navigator hierarchy display and
select Run. Under PL/SQL Block in the Run PL/SQL dialog box, change, change IN_
RATING => IN_RATING to IN_RATING => 10, and click OK. In the Log window,
however, you see unexpected output: many titles are listed, including some with
ratings other than 10. So, you decide to debug the procedure.
To debug the procedure, follow these steps:
1. Click the Compile for Debug icon in the toolbar under the LIST_A_RATING2 tab.
2. Set two breakpoints by clicking in the left margin (left of the thin vertical line)
beside each of these two lines:
FETCH the_cursor INTO matching_title;
FETCH rating_cursor INTO matching_rating;
Clicking in the left margin toggles the setting and unsetting of breakpoints.
Clicking beside these two lines will enable you to see the values of the matching_
title and matching_rating variables as execution proceeds in debug mode.
3. On the Debug menu, select Debug LIST_A_RATING2. Ensure that the line IN_
RATING => IN_RATING has been changed to IN_RATING => 10, and click OK.
4. Click View, then Debugger, then Data to display the Data pane. (Tip: Expand the
Name column width so that you can see MATCHING_RATING.)
5. Press the F9 key (or click Debug, then Resume) to have execution proceed,
stopping at the next breakpoint.
6. Repeatedly press the F9 key (or click Debug, then Resume), noticing especially the
value of MATCHING_RATING as each row is processed. You will notice the first
incorrect result when you see that the title Get Rich Really Fast is included, even
though its rating is only 1 (obviously less than 10). (See the screen illustration with
debugging information in Section 1.6, "Running and Debugging Functions and
Procedures".)
7. When you have enough information to fix the problem, you can click the
Debugging - Log tab, and Terminate icon in the debugging toolbar.
From this debugging session, you know that to fix the logic error, you should change
rating <= :in_rating to rating = :in_rating in the definition of the_cursor.
Notice the automatic highlighting of SQL keywords (SELECT and FROM in this
example).
Click the Execute SQL Statement icon in the SQL Worksheet toolbar. The results of the
query are displayed on the Results tab under the area in which you entered the SQL
statement.
In the Enter SQL Statement box, enter (or copy and paste) the following statement,
which is the same as the SELECT statement in the view you created in Create a View:
SELECT p.patron_id,
p.last_name,
p.first_name,
t.transaction_type,
t.transaction_date
FROM patrons p, transactions t
WHERE p.patron_id = t.patron_id
ORDER BY p.patron_id, t.transaction_type;
Click the Execute SQL Statement icon in the SQL Worksheet toolbar, and view the
results of the query.
Click the Execute Explain Plan icon in the SQL Worksheet toolbar to see the execution
plan (displayed on the Explain tab) that Oracle Database follows to execute the SQL
statement. The information includes the optimizer strategy and the cost of executing
the statement. (For information about how to generate and interpret execution plans,
see Oracle Database Performance Tuning Guide.)
4.10 Script for Creating and Using the Library Tutorial Objects
The following statements create and use the database objects that you have created (or
will create) for the tutorial in Chapter 4, "Tutorial: Creating Objects for a Small
Database". You can view these commands to help you understand the library database
objects that are covered in the tutorial.
-- Clean up from any previous tutorial actions.
DROP TABLE transactions;
DROP TABLE books;
DROP TABLE patrons;
DROP SEQUENCE patron_id_seq;
DROP SEQUENCE transactions_seq;
DROP TRIGGER transactions_trg;
DROP VIEW patrons_trans_view;
DROP PROCEDURE list_a_rating;
DROP PROCEDURE list_a_rating2;
set serveroutput on
-- Create objects.
INSERT INTO books VALUES ('A1111', 'Moby Dick', 'Melville', 'Herman', 10);
INSERT INTO books VALUES ('A2222', 'Get Rich Really Fast', 'Scammer', 'Ima', 1);
INSERT INTO books VALUES ('A3333', 'Finding Inner Peace', 'Blissford', 'Serenity',
null);
INSERT INTO books VALUES ('A4444', 'Great Mystery Stories', 'Whodunit', 'Rodney',
5);
INSERT INTO books VALUES ('A5555', 'Software Wizardry', 'Abugov', 'D.', 10);
SQL Developer uses dialog boxes for creating and editing database connections and
objects in the database (tables, views, procedures, and so on). The dialog boxes
sometimes have multiple tabs, each reflecting a logical grouping of properties for that
type of object.
For an explanation of any dialog box or tab, click the Help button or press the F1 key.
The dialog boxes are not presented here in any rigorous order, because the help for
each box is an independent piece of information and is normally seen when you click
Help or press F1 in that box.
Note: For all Name fields, any name that you type is automatically
converted to and stored in the database metadata in uppercase, unless
you enclose the name in quotation marks (" "). (Names of database
objects in SQL and PL/SQL statements are not case-sensitive.)
To include lowercase characters, special characters, or spaces in object
names, enclose the name in quotation marks (" ") when you type it.
Example: "My table"
Connection
Access Method: The method by which the client will gain access to and authenticate
against the server. The methods available depend on which CVS preferences you have
set; the available methods might include External, Password Server, Secure Shell via
SSH2, and [Other].
Most of the remaining Connection fields apply only to specific Access Method values.
User Name: A CVS user name known to the repository.
Host Name: Qualified host name or IP address of the CVS server system.
Port: TCP/IP port number on which the repository is listening.
Repository Path: The location of the CVS repository software. The seeded / can be
overwritten with a path in the format suitable for your operating system, for example
c:\cvs. A simple formatting error, such as a forward slash instead of a backslash, will
result in a message asking you to enter a valid repository path.
SSH2 Key: Path and file name for the SSH2 private key file for this connection. You
can generate a SSH2 private key file using Generate SSH2 Key Pair.
Generate SSH2 Key Pair: Displays a dialog box for generating an SSH2 key pair (that
is, a private key file and a public key file). You specify the private key file in the SSH2
Key box. You add the details of the public key file to the list of public keys on the CVS
server system
Use HTTP Proxy Settings: Check (enable) this option if you are behind a firewall and
need to use HTTP to access the CVS server.
External Locator Configuration: Displays the External Locator Configuration dialog
box, in which you can edit the details of the remote shell client and remote server
program.
Root
Value of CVSROOT: CVS root variable made up from the information that you have
already provided. This variable provides the client with access details when contacting
the server. The format of the seeded variable is:
:accessmethod:username@serverlocation:repositorypath
You would not normally need to change this value. One instance when you would
change this value is when you are attempting to connect to a CVSNT server through a
firewall. In this case, you would add proxy information to the beginning of the
username portion, so that the CVS root variable would take the following form:
:accessmethod:proxy=proxyname;proxyport=portnumber:username@serverlocation:re
positorypath
Test
Test Connection: Attempts to establish a connection to the CVS repository.
Status: Displays the result of the test (success or an error message).
Name
Connection Name: Name to identify the connection to the CVS repository. The default
name is the same as the CVSROOT value.
Summary
Displays the connection information that you have specified. To make any corrections,
click Back as needed and modify the information. To create the connection, click
Finish.
Oracle tab
The following information applies to a connection to an Oracle Database.
Role: The set of privileges to be associated with the connection. For a user that has
been granted the SYSDBA system privilege, you can specify a connection that includes
the privilege.
Connection Type: Select Basic, TNS, LDAP (Lightweight Directory Access Protocol),
or Advanced. (The display of fields changes to reflect any change in connection type.)
OS Authentication: If this option is checked, control of user authentication is passed
to the operating system (OS). This allows the specified user to connect to the database
by authenticating that user’s OS username in the database. No password is associated
with the connection since it is assumed that OS authentication is sufficient. For
information about using OS authentication, see Oracle Database JDBC Developer's Guide.
Kerberos Authentication: If this option is checked, credentials can be shared across
many Kerberos-enabled applications (for example, to have the same username and
password for both the operating system and Oracle Database). Thick driver
configuration is done through sqlnet.ora (sqlnet.authentication_
services=(KERBEROS) and related parameters), so no username and password are
needed. Thin driver configuration uses the configuration (.conf) file and the
credentials cache, and uses a service principal and password. For more information
about Kerberos authentication options, see Database: Advanced. For information
about configuring Kerberos authentication, see Oracle Database Advanced Security
Administrator's Guide.
Proxy Connection: If this option is checked, proxy authentication will be used, as
explained in Section 1.4.5, "Connections with Proxy Authentication". Displays the
Oracle Proxy Authentication dialog box.
SQL Developer is running must have an Oracle Client installation that contains the
JDBC and orai18n libraries, these libraries must be present on the path, and the Oracle
Client installation must be version 10.2 or later.
Note that in this example, the "/" is required, and the user will be prompted to enter
the password.
To use a custom JDBC URL, the system on which SQL Developer is running must have
an Oracle Client installation that contains the JDBC and orai18n libraries, is present on
the path, and is version 10.2 or later.
TimesTen tab
The following information applies to a connection to an Oracle TimesTen In-Memory
Database.
For Username and Password, specify the user name and password of the user account
in the TimesTen database.
DSN: Data source name. Select an existing DSN (if any are displayed), or User-specified
to create a new DSN. A DSN is a character string that identifies a TimesTen database
and includes connection attributes to be used when connecting to the database. A DSN
has the following characteristics: its maximum length is 32 characters; it cannot contain
spaces; and it consists of ASCII characters except for the following: []{},;?*=!@\
Connection Type (if DNS is user-specified): C/S for client-server mode or Direct for
direct mode
Connection String: Connection attributes including database attributes, first
connection attributes, general connection attributes, NLS attributes, and Cache
Connect attributes. (See the TimesTen Cache Connect to Oracle Guide for information
about the attributes.)
Oracle Password (for Cache): The password for the TimesTen user account on the
Oracle Database. (See the TimesTen documentation for more information.)
For more information about SQL Developer support for TimesTen, see Section 1.15.
For detailed usage and reference information about Oracle TimesTen, see the online
documentation that is included in the TimesTen installation. For additional
information, go to:
http://www.oracle.com/technology/products/timesten/
Access tab
For a connection to a Microsoft Access database, click Browse and find the database
(.mdb) file. However, to be able to use the connection, you must first ensure that the
system tables in the database file are readable by SQL Developer, as follows:
1. Open the database (.mdb) file in Microsoft Access.
2. Click Tools, then Options, and on the View tab ensure that System Objects are
shown.
3. Click Tools, then Security, and, if necessary, modify the user and group
permissions for the MSysObjects, MsysQueries, and MSysRelationships tables as
follows: select the table and give the Admin user at least Read Design and Read
Data permission on the table.
4. Save changes and close the Access database file.
5. Create and test the connection in SQL Developer.
DB2 tab
The following information applies to a connection to an IBM DB2 database.
Note that to connect to an IBM DB2 database, you must first download the db2jcc.jar
and db2jcc_license_cu.jar files, and then click Tools, then Preferences, and use the
SQL Developer user preference pane for Database: Third Party JDBC Drivers to add
these files.
Platform: UDB or iSeries.
Host Name: Host system for the IBM DB2 database.
Port: TCP/IP Port on which the IBM DB2 server will listen.
Enter Database: Name of the IBM DB2 database.
JDBC tab
The following information applies to a JDBC connection.
JDBC-ODBC Bridge or Other Third Party Driver: Indicates a JDBC to ODBC bridge
driver or another third-party driver.
Data Source (JDBC-ODBC Bridge): Name of an existing ODBC data source.
Extra Parameters (JDBC-ODBC Bridge): Additional parameters for the connection.
JDBC URL (Other Third Party Driver): URL for connecting directly from Java to the
database; overrides any other connection type specification.
Driver Class (Other Third Party Driver): The name of the driver class that will be used
for the connection (for example,
com.microsoft.jdbc.sqlserver.SQLServerDriver). This name can be found
in the JDBC driver specification (usually shipped with the driver).
MySQL tab
The following information applies to a connection to a MySQL database.
Note that to connect to a MySQL database, you must first download the appropriate
MySQL connection driver, and then click Tools, then Preferences, and use the SQL
Developer user preference pane for Database: Third Party JDBC Drivers to add the
driver.
Host Name: Host system for the MySQL database.
Port: TCP/IP Port on which the MySQL server will listen.
Choose Database: Name of the MySQL database.
Zero Date Handling: Because the MySQL JDBC driver cannot handle the default
0000-00-00 date, specify one of the following options for handling this date: Set to
NULL to set it to a null value, or Round to 0001-01-01 to set it to 0001-01-01.
Teradata tab
The following information applies to a connection to a Teradata database.
Note that to connect to a Teradata database, you must first download the
tdgssconfig.jar and a terajdbc4.jar files, and then click Tools, then Preferences, and use
the SQL Developer user preference pane for Database: Third Party JDBC Drivers to
add these files. (See also the readme.txt file that is included with the tdgssconfig.jar
and a terajdbc4.jar files.)
Host Name: Host system for the Teradata database.
DBS Port: TCP/IP Port on which the Teradata server will listen.
Charset: Character set for the data.
TMODE: Transaction mode: ANSI, TERA (Teradata), or DEFAULT.
To add a connection parameter to the list in the box, click Add; to delete a connection
parameter from the list, click Delete.
Data Preview
Worksheet: Name of a worksheet in the Microsoft Excel file.
Header row?: If this option is checked, the first row in the selected Microsoft Excel
worksheet is considered a row with text for the column headings. If this option is not
checked, the first row is considered to contain worksheet data.
Locale: Language for any text data in the worksheet.
Choose Columns
Available Columns: Lists the Microsoft Excel worksheet columns from which you can
select for import into columns in the table. To select one or more worksheet columns,
use the arrow buttons to move columns from Available to Selected.
Selected Columns: Lists the columns whose data is to be imported into columns in the
database table. To change the order of a selected column in the list for the import
operation, select it and use the up and down arrow buttons.
Column Definition
Enables you to specify the name of the database table and information about the
columns in that table.
Table Name: Name of the database table into which to import the Excel data.
Source Data Columns and Target Table Columns: You can select a source (Excel)
data column to display its target (Oracle) column properties. For Data Type, select one
of the supported types for this import operation. For a VARCHAR2 or NUMBER
column, you must specify an appropriate Size/Precision value. You can specify
whether the column value can be null (Nullable?), and you can specify a default value
(Default).
Finish
Verify: You must verify the import parameters. If any test fails, the Information
column contains a brief explanation, and you must go back and fix any errors before
you can click Finish.
Send to Worksheet: Does not immediately perform the import operation, but instead
opens a SQL Worksheet with statements that will be used after you click the Run
Script icon in the worksheet.
To perform the import operation, or to send the statements to a SQL Worksheet if you
so specified, click Finish.
Authentication - User Name and Password: The user name and password on the
target instance. This information authenticates the user to the remote server and is
required for security. The specified user and password must be a valid user and
password on the remote instance.
DDL tab
You can review and save the SQL statement that SQL Developer will use to create the
database link.
Properties
Enables you to specify index properties such as compression, parallelism, and storage
options.
Partitions
When applicable, enables you to specify whether the index is not partitioned, locally
partitioned, or globally partitioned. If you specify Local or Global, additional fields are
displayed relevant to the selected partitioning option.
Local: Specifies that the index is partitioned on the same columns, with the same
number of partitions and the same partition bounds as its associated table. Oracle
Database automatically maintains local index partitioning as the underlying table is
repartitioned.
Global: Specifies that the partitioning of the index is user defined and is not
equipartitioned with the underlying table. You can partition a global index by range or
by hash. In both cases, you can specify up to 32 columns as partitioning key columns.
The partitioning column list must specify a left prefix of the index column list. If the
index is defined on columns a, b, and c, then for the columns you can specify (a, b, c),
or (a, b), or (a, c), but you cannot specify (b, c) or (c) or (b, a). If you omit the partition
names, then Oracle Database assigns names of the form SYS_Pn.
Properties tab
Tablespace: Tablespace in which the materialized view log is to be created.
DDL tab
You can view a SQL CREATE statement that reflects the current definition of the
object, or a SQL ALTER statement to modify an existing object to reflect your changes.
To save the SQL statement to a script file, click Save and specify the location and file
name.
The package is created and is displayed in the Editor window, where you can enter the
details.
Parameters tab
For each parameter in the procedure to be created, specify the following information.
Name: Name of the parameter.
Type: Data type of the parameter.
Mode: IN for input only, OUT for output only, or IN OUT for input and output (that
is, the output is stored in the parameter overwriting its initial input value).
Default Value: Optionally, the default value if the parameter is omitted or specified as
null when the subprogram is called.
To add a parameter, click the Add (+) icon; to delete a parameter, click the Remove (X)
icon; to move a parameter up or down in the list, click the up-arrow or down-arrow
icon.
DDL tab
You can view a SQL CREATE statement that reflects the current definition of the
object, or a SQL ALTER statement to modify an existing object to reflect your changes.
Cycle: Indicates whether the sequence "wraps around" to reuse numbers after
reaching its maximum value (for an ascending sequence) or its minimum value (for a
descending sequence). If cycling of values is not enabled, the sequence cannot generate
more values after reaching its maximum or minimum value.
Cache and Cache size: If Cache is checked, sequence values are preallocated in cache,
which can improve application performance; Cache size indicates the number of
sequence values preallocated in cache. If Cache is not checked, sequence values are not
preallocated in cache.
Order: Indicates whether sequence numbers are generated in the order in which they
are requested. If no ordering is specified, sequence numbers are not guaranteed to be
in the order in which they were requested.
DDL tab
You can review the SQL statement that SQL Developer will use to create a new
sequence or that reflects any changes you have made to the sequence properties.
DDL tab
You can review the SQL statement that SQL Developer will use to create a new
synonym or that reflects any changes you have made to the synonym properties.
Column Name: Name of the column. Must be unique within the table. Suggestion: For
a new column, replace any default name, such as COLUMN1.
Type: Data type for the column. The drop-down list includes only selected frequently
used data types. To specify any other type for the column, you must use the Columns
panel of the Create/Edit Table (with advanced options) dialog box.
Size: For VARCHAR2 data, the maximum size of the column data; for NUMBER data,
the maximum number of digits.
Not Null: If this option is checked, the column must contain data; you cannot specify
no value or an explicit null value for this column when you insert a row. If this option
is not checked, the column can contain either data or no data.
Primary Key: If this option is checked, the column is the primary key, or part of the
primary key, for the table. The primary key is the column, or set of columns, that
uniquely identifies each row in the table. A primary key column cannot be null.
If you want to have the primary key values automatically populated by a convenient
method that uses a before-insert trigger and a sequence, then before you finish
creating the table, you must check the Advanced box and use the Primary Key tab,
starting with the Populate Primary Key Column field.
To add another column, click Add Column. When you are finished adding columns,
either click OK or click the DDL tab to review the CREATE TABLE statement.
properties. If you want to make any changes, go back to the Table tab and make the
changes there.
When you are finished, click OK.
Columns pane
Specifies properties for each column in the table.
Columns: Lists the columns currently in the table. To add a column, click the Add
Column (+) icon; to delete a column, select it and click the Remove Column (X) icon; to
move a column up or down in the table definition, select it and use the up-arrow and
down-arrow buttons.
To copy in column definitions from another table, click the Copy Columns icon to
display the Copy Columns dialog box.
Note: After you add a column, to add another column, click the Add
Column (+) icon.
Name: Name of the column. Must be unique within the table. Suggestion: For a new
column, replace any default name, such as COLUMN1.
From: An existing sequence that you select, or a new sequence whose name you enter.
(For a new sequence, SQL Developer creates the sequence automatically using the
name that you enter.)
Trigger Name: The name for the before-insert trigger that will be automatically
created. This trigger uses the sequence to generate a new value for the primary key
when a row is inserted. For an example of using this technique, see the tutorial section
Section 4.3, "Create a Table (TRANSACTIONS)".
Name: Name of the unique constraint. Must be unique within the database.
Enabled: If this option is checked, the unique constraint is enforced.
Available Columns: Lists the columns that are available to be added to the unique
constraint definition.
Selected Columns: Lists the columns that are included in the unique constraint
definition.
To add a column to the unique constraint definition, select it in Available Columns
and click the Add (>) icon; to remove a column from the unique constraint definition,
select it in Selected Columns and click the Remove (<) icon. To move all columns from
available to selected (or the reverse), use the Add All (>>) or Remove All (<<) icon. To
move a column up or down in the unique constraint definition, select it in Selected
Columns and use the arrow buttons.
Note: After you add a foreign key, to add another foreign key, click
the Add button.
Name: Name of the foreign key definition. Must be unique within the database.
Enabled: If this option is checked, the foreign key is enforced.
Referenced Schema: Name of the schema containing the table with the primary key or
unique constraint to which this foreign key refers.
Referenced Table: Name of the table with the primary key or unique constraint to
which this foreign key refers.
Referenced Constraint: Name of the primary key or unique constraint to which this
foreign key refers.
Associations: Local Column: Lists the column in the currently selected (local) table
that is included in the foreign key definition. For each local column in the foreign key
definition, select the name of a column in the local table.
Associations: Referenced Column on [table]: For each local column, identifies the
column in the other (foreign) table that must have a value matching the value in the
local column.
Name: Name of the check constraint definition. Must be unique within the database.
Enabled: If this option is checked, the check constraint is enforced.
Condition: Condition that must be met for a row. Can be any valid CHECK clause
(without the CHECK keyword). For example, to indicate that the value in a numeric
column named RATING must be from 1 to 10, you can specify: rating >=1 and
rating <= 10
To add another check constraint, click the Add button.
Indexes pane
Specifies properties for each index on the table.
Indexes: Lists the indexes currently defined on the table. To add an index, click the
Add Index (+) icon; to delete an index, select it and click the Remove Index (X) icon.
Note: After you add an index, to add another index, click the Add
Index (+) icon.
an index expression, click the Remove Column Expression (X) icon; to move an index
expression up or down in the list, click the Move Column Up and Move Column
Down icons. An index must have at least one index expression.
For example, to create an index on the AUTHOR_LAST_NAME column of the BOOKS
table from the tutorial (see Create a Table (BOOKS)), click the + icon, and select
AUTHOR_LAST_NAME in Column Name or Expression (next field), which changes
BOOKS to AUTHOR_LAST_NAME in the Index field.
Column Name or Expression: A column name or column expression. A column
expression is an expression built from columns, constants, SQL functions, and
user-defined functions. When you specify a column expression, you create a
function-based index.
Order: ASC for an ascending index (index values sorted in ascending order); DESC for
a descending index (index values sorted in descending order).
Buffer Pool: <DEFAULT> means to use the Oracle Database default. KEEP means to
put blocks from the segment into the Keep buffer pool; maintaining an appropriately
sized Keep buffer pool lets Oracle retain the database object in memory to avoid I/O
operations. RECYCLE means to put blocks from the segment into the Recycle pool; an
appropriately sized Recycle pool reduces the number of objects whose default pool is
the Recycle pool from taking up unnecessary cache space.
Free Lists: Number of free lists for each of the free list groups for the table. The default
and minimum value for this parameter is 1, meaning that each free list group contains
one free list.
Free List Groups: Number of groups of free lists for the table. The default and
minimum value for this parameter is 1. Oracle uses the instance number of Real
Application Clusters instances to map each instance to one free list group.
Partitioning pane
Specifies partitioning options for a partitioned table, which is a table that is organized
into smaller and more manageable pieces called partitions. SQL queries and DML
statements do not need to be modified in order to access partitioned tables; however,
after partitions are defined, DDL statements can access and manipulate individuals
partitions rather than entire tables or indexes. Also, partitioning is entirely transparent
to applications.
Partition By: The type of partitioning: RANGE partitions the table on ranges of values
from the column list (which for an index-organized tablet must be a subset of the
primary key columns of the table); HASH partitions the table using the hash method
(rows assigned to partitions using a hash function on values found in columns
designated as the partitioning key); LIST partitions the table on lists of literal values
from column (useful for controlling how individual rows map to specific partitions).
Available: Lists the columns whose values are available to be used in assigning rows
to partitions.
Selected: Lists the column whose values are to be used in assigning rows to partitions.
To add a column to the partitioning definition, select it in Available Columns and click
the Add (>) icon; to remove a column from the partitioning definition, select it in
Selected Columns and click the Remove (<) icon. To move all columns from available
to selected (or the reverse), use the Add All (>>) or Remove All (<<) icon. To move a
column up or down in the partitioning definition, select it in Selected Columns and
use the arrow buttons.
Subpartition By: The partitioning type to be used to create subpartitions within each
range partition. Use the Available and Selected column lists select and deselect a
column for subpartitioning.
Subpartition Details: For each subpartition template, specify a name and (if relevant)
a value or set of values that is appropriate for the subpartition type.
Storage: Enables you to specify a tablespace for the subpartition.
Access Driver: The access driver of the external table. The access driver is the API that
interprets the external data for the database: ORACLE_LOADER or ORACLE_
DATAPUMP. You must specify the ORACLE_DATAPUMP access driver if you
specify the AS subquery clause to unload data from one Oracle database and reload it
into the same database or a different Oracle database.
Access Type: Type of data to be automatically converted during loads and unloads:
BLOB or CLOB.
Default Directory: A default directory object corresponding to a directory on the file
system where the external data sources may reside. The default directory can also be
used by the access driver to store auxiliary files such as error logs.
Project Column: Determines how the access driver validates the rows of an external
table in subsequent queries. ALL processes all column values, regardless of which
columns are selected, and validates only those rows with fully valid column entries. If
any column value would raise an error, such as a data type conversion error, the row
is rejected even if that column was not referenced in the select list. REFERENCED
processes only those columns in the select list.
The ALL setting guarantees consistent result sets. The REFERENCED setting can
result in different numbers of rows returned, depending on the columns referenced in
subsequent queries, but is faster than the ALL setting. If a subsequent query selects all
columns of the external table, then the settings behave identically.
Reject Limit: The number of conversion errors can occur during a query of the
external data before an Oracle Database error is returned and the query is aborted.
Access Parameters: Values to the parameters of the specific access driver for this
external table.
Location Specifications: One or more external data sources. Each is usually a file, but
it need not be. Oracle Database does not interpret this clause; it is up to the access
driver to interpret this information in the context of the external data. Use the Add (+)
icon to add each location specification.
Comment pane
Optional descriptive comment about the table.
DDL pane
You can review and save the CREATE TABLE statement that SQL Developer will use
to create a new table or that reflects any changes you have made to the table
properties. If you want to make any changes, go back to the relevant tabs and make
the changes there.
To save the SQL statement to a script file, click Save and specify the location and file
name.
When you are finished, click OK.
Pct Used: Minimum percentage of used space that Oracle maintains for each data
block. A block becomes a candidate for row insertions when its used space falls below
the Pct Used value. You can enter a value from 1 through 99.
Logging: <DEFAULT> means to use the Oracle Database default. ON means that the
table creation and any subsequent direct loader (SQL*Loader) and direct-path INSERT
operations against the table, partition, or LOB storage are logged in the redo log file.
OFF means that these operations are not logged in the redo log file.
Ini Trans: Number of update transaction entries for which space is initially reserved in
the data block header.
Max Trans: Number of transaction entries that could concurrently use data in a data
block. This parameter has been deprecated. Oracle Database now automatically allows
up to 255 concurrent update transactions for any data block, depending on the
available space in the block.
Extents - Initial: Size of the first extent of the table or index. Specify K (kilobytes) or M
(megabytes) for the unit associated with the number.
Extents - Next: Size of the next extent to be allocated to the table or index. Specify K
(kilobytes) or M (megabytes) for the unit associated with the number.
Extents - Min: Minimum number of extents allocated when the table or index is
created.
Extents - Max: Maximum number of extents allocated when the table or index is
created. Unlimited (if checked) means that there is no maximum (and any specified
maximum is ignored).
Pct Increase: Percentage that each extent grows over the previous extent.
Buffer Pool: <DEFAULT> means to use the Oracle Database default. KEEP means to
put blocks from the segment into the Keep buffer pool; maintaining an appropriately
sized Keep buffer pool lets Oracle retain the database object in memory to avoid I/O
operations. RECYCLE means to put blocks from the segment into the Recycle pool; an
appropriately sized Recycle pool reduces the number of objects whose default pool is
the Recycle pool from taking up unnecessary cache space.
Free Lists: Number of free lists for each of the free list groups for the table or index.
The default and minimum value for this parameter is 1, meaning that each free list
group contains one free list.
Free List Groups: Number of groups of free lists for the table or index. The default and
minimum value for this parameter is 1. Oracle uses the instance number of Real
Application Clusters instances to map each instance to one free list group.
Trigger tab
Trigger Type: The type of object on which to create the trigger: TABLE, VIEW,
SCHEMA, or DATABASE. (The remaining items depend on the type of trigger.)
Table Owner or View Owner: For a trigger on a table or a view, the name of the
owner of the table or the view.
Table Name or View Name : For a trigger on a table or a view, the name of the table
or the view.
Before or After: For a trigger on a table, select Before to cause the database to fire the
trigger before executing the triggering event, or select After to cause the database to
fire the trigger after executing the triggering event.
Statement Level or Row Level: For a trigger on a table, Statement Level fires the
trigger once before or after the triggering statement that meets the optional trigger
constraint defined in the WHEN condition; Row Level fires the trigger once for each
row that is affected by the triggering statement and that meets the optional trigger
constraint defined in the WHEN condition.
Insert, Update, Delete: For a trigger on a table or a view, Insert fires the trigger
whenever an INSERT statement adds a row to a table or adds an element to a nested
table; Update fires fire the trigger whenever an UPDATE statement changes a value in
one of the columns specified in Selected Columns (or in any column if no columns are
specified); Delete fires the trigger whenever a DELETE statement removes a row from
the table or removes an element from a nested table.
Referencing - Old: For a trigger on a table, the correlation names in the PL/SQL block
and WHEN condition of a row trigger to refer specifically to old value of the current
row.
Referencing - New: For a trigger on a table, the correlation names in the PL/SQL
block and WHEN condition of a row trigger to refer specifically to new value of the
current row.
Available Columns: For a trigger on a table, lists the columns from which you can
select for use in an Update trigger definition.
Selected Columns: For a trigger on a table, lists the columns used in an Update trigger
definition.
When: For a trigger on a table, an optional trigger condition, which is a SQL condition
that must be satisfied for the database to fire the trigger. This condition must contain
correlation names and cannot contain a query.
Schema: For a trigger on a schema, the name of the schema on which to create the
trigger.
Available Events: For a trigger on a schema or database, lists events from which you
can select for use in the trigger definition.
Selected Events: For a trigger on a schema or database, lists events used in the trigger
definition.
DDL tab
You can view a SQL CREATE statement that reflects the current definition of the
object, or a SQL ALTER statement to modify an existing object to reflect your changes.
User tab
Specifies general properties for the database user.
User Name: The user name string. For an existing user, this field is read-only; to
change the name, you must drop the user and create a new user with the desired
name.
New Password: Password string for the new user, or new password for an existing
user. You must also type the same password string for Confirm Password.
Password Expired: If this option is checked, the password is marked as expired, and
the user must change the password before being permitted to connect to the database.
Account Locked: If this option is checked, the user will not be permitted to connect to
the database until a DBA user unlocks the account associated with this user.
Roles tab
Specifies roles to be granted to the user. For each role, you can check Granted to grant
the role, Admin to permit the user to grant the role to other users, and Default to use
the default settings for Granted and Admin.
For convenience, you can click buttons to affect all settings (Grant All, Revoke All,
Admin All, Admin None, Default All, Default None); then, you can specify other
settings for individual roles.
Quotas tab
Specifies disk usage limits on specified tablespaces for the user. If you check
Unlimited, there is no disk usage limit on the tablespace.
SQL tab
Displays the SQL statements that SQL Developer will use to create (after executing a
CREATE USER statement) a new user or to edit an existing user. This display is
read-only; if you want to make any changes, go back to the relevant tabs and make the
changes there.
Details tab
Name: Name of the user-defined report.
Style: Report style: Table (default), Code (formats the code in the output), Chart (bar or
pie chart; see Section 1.11.15.1, "User-Defined Report Example: Chart" for an example),
Gauge (dial or status meter; see Section 1.7.8, "Gauges: In the SQL Worksheet and
User-Defined Reports"), plsql-dbms_output (dynamic HTML; see Section 1.11.15.2,
"User-Defined Report Example: Dynamic HTML" for an example), or Script
(executable script).
Description: Optional description of the report.
ToolTip: Optional tooltip text to be displayed when the mouse pointer stays briefly
over the report name in the Reports navigator display.
SQL Statement: The complete SQL statement for retrieving the information to be
displayed in the user-defined report. As a trivial example, the statement SELECT user
"Current User" FROM DUAL displays Current User as the heading and the name of
the user associated with the current database connection.
Suggestion: Look at the SQL statements for various SQL Developer-supplied reports;
check the Messages - Log pane below the report results, or click the SQL icon under
the Report Results tab.
Binds tab
Name: Name of the bind variable.
Prompt: String displayed when the user is prompted to enter a value. Example: Table
name
Default: Default value if the user does not enter a value at the prompt. To accept the
Oracle SQL value, specify NULL_VALUE.
ToolTip: Optional tooltip text to be displayed when the mouse pointer stays briefly
over the bind variable name.
SQL Parse Results: If you click Test Syntax, displays any SQL syntax errors, or
displays a message indicating no errors if there are no syntax errors.
Revert: Cancels any edits you have made in the SQL Query box, and displays the
contents of the box before these edits.
Test Syntax: Checks the statement in the SQL Query box for any SQL syntax errors.
Test Query: Displays a dialog box that runs the SQL query and indicates the result. If
there is an error in the query, such as an invalid character or a missing expression, the
error is displayed.
Available: Lists the objects (typically, tables and views in a hierarchical display) from
which you can select objects to use in the SELECT, FROM, and WHERE clauses of the
view definition.
Selected: Lists the objects (typically, columns) that you can use in the SELECT, FROM,
and WHERE clauses of the view definition.
To add an object as selected, select it in Available and click the Add (>) icon; to remove
an object as selected, select it in Selected and click the Remove (<) icon. To move all
objects from selected to available, use the Remove All (<<) icon. To move an object up
or down in the selected list, select it in Selected and use the arrow buttons.
For the example in DDL tab or pane, select the DEPTNO and SAL columns from the
EMP table.
Note: After you add an object, to add another object, click the Add
(+) icon.
Expression: Column name or an expression. For expressions, you can type them, or
you can use the Expression Palette to add object names and function names.
Validate: Checks the validity of the Expression entry.
For the example in DDL tab or pane, select DEPTNO column and the MIN(emp.sal)
and MAX(emp.sal) functions.
Note: After you add an object, to add another object, click the Add
(+) icon.
ORDER BY Expression Filter: For each column or column expression, you can type
the text completely into the Expression box; or you can type some of the text and use
the Expression Palette to add object names, function names, and operators.
Validate: Tests the validity of the syntax for the expression.
Order: ASC for ascending (expression values sorted in ascending order); DESC for
descending (expression values sorted in descending order).
Nulls Ordering: NULLS FIRST to have null expression values appear before non-null
values; NULLS LAST to have null expression values appear after non-null values.
("Before" and "after" positions are determined by the Order value.)
■ Specify: Performs refresh operations according to what you specify in the Start on
and Next fields.
■ Never: Does not perform a refresh operation.
Type: Refresh type, which determines the type of materialized view:
■ Primary Key: Creates a primary key materialized view, which allows materialized
view master tables to be reorganized without affecting the eligibility of the
materialized view for fast refresh.
■ Row ID: Creates a rowid materialized view, which is useful if the materialized
view does not include all primary key columns of the master tables.
Start on: Starting date and time for the first automatic refresh operation. Must be in
the future.
Next: Time for the next automatic refresh operation. The interval between the Start on
and Next times establishes the interval for subsequent automatic refresh operations. If
you do not specify a value, the refresh operation is performed only once at the time
specified for Start on.
Constraints: If this option is checked, more rewrite alternatives can be used during the
refresh operation, resulting in more efficient refresh execution. The behavior of this
option is affected by whether you select Enforced or Trusted.
Enforced: Causes only enforced constraints to be used during the refresh operation.
Trusted: Enables the use of dimension and constraint information that has been
declared trustworthy by the database administrator but that has not been validated by
the database. If the dimension and constraint information is valid, performance may
improve. However, if this information is invalid, then the refresh procedure may
corrupt the materialized view even though it returns a success status.
Materialized View Options:
Parallel: If this option is checked, parallel operations will be supported for the
materialized view, and you can specify a number for the default degree of parallelism
for queries and DML on the materialized view after creation.
Enable Cache: If this option is checked, the blocks retrieved for this table are placed at
the most recently used end of the least recently used (LRU) list in the buffer cache
when a full table scan is performed. This setting is useful for small lookup tables. If
this option is not checked, the blocks are placed at the least recently used end of the
LRU list.
Build Type: Specifies when to populate the materialized view. Immediate indicates
that the materialized view is to be populated immediately. Deferred indicates that the
materialized view is to be populated by the next refresh operation. If you specify
Deferred, the first (deferred) refresh must always be a complete refresh; until then, the
materialized view has a staleness value of unusable, so it cannot be used for query
rewrite.
Enable Query Rewrite: If this option is checked, the materialized view is enabled for
query rewrite, an optimization technique that transforms a user request written in
terms of master tables into a semantically equivalent request that includes one or more
materialized views.
Prebuilt Option: If this option is checked, an existing table is registered as a
preinitialized materialized view. This option is particularly useful for registering large
materialized views in a data warehousing environment. The table must have the same
name and be in the same schema as the resulting materialized view, and the table
should reflect the materialization of a subquery. Reduced Precision authorizes the loss
of precision that will result if the precision of the table or materialized view columns
do not exactly match the precision returned by subquery. No Reduced Precision
requires that the precision of the table or materialized view columns match exactly the
precision returned by subquery, or the create operation will fail.
Index Storage Options:
Use Index: If this option is checked, a default index is created and used to speed up
incremental (fast) refresh of the materialized view. If this option is not checked, this
default index is not created. (For example, you might choose to suppress the index
creation now and to create such an index explicitly later.)
Use Tablespace: If this option is checked, you can specify the tablespace in which the
materialized view is to be created. If this option is not checked, the materialized view
is created in the default tablespace of the schema containing the materialized view.
Source/Destination pane
Source Connection: Database connection for the schema from which to copy the
objects.
Destination Connection: Database connection for the schema to which to copy the
objects
Create Objects: Copies the objects to new objects in the destination schema only if an
existing object of that type with the same name does not already exist.
Truncate Objects: Deletes existing rows in any existing table with the same name, and
then loads rows from the source.
Drop Objects: Drops any existing table with the same name, and then creates and
loads it from the source.
To perform the copy operation, click Finish. After the copy operation completes, a log
file is displayed.
Source/Destination pane
Source Connection: Database connection for the source schema (the schema in which
selected objects are to be compared with objects in the destination schema).
Destination Connection: Database connection for the database that contains the
destination schema (the schema containing one or more objects of the same type and
name as those selected in the source schema). The selected connection can be the same
as, or different from, the connection for the source schema.
Diff Objects: Check the types of objects that you want to be compared in the source
and destination connections. You can click Toggle All to check and uncheck all
individual types. You must select at least one object type.
Proceed to Summary: If this option is checked, clicking Next takes you directly to the
Diff Summary pane.
ID conflicts, such as when you need to have two versions of the same application in
the same instance. For example, you might be migrating an application to a
production instance and still need to maintain the development version.
ID Currently Used by and Overwrite: If the specified Application ID is currently used
by another application, you can enable Overwrite to have the application ID instead
associated with the application being deployed or imported.
Summary
Displays the selected options for the application to be deployed or imported. To make
any changes, click Back. To perform the operation, click Finish.
Source/Destination pane
Specify the output file, the database connection, and options that affect the content
(DDL statements) of the output file.
File: Specify the name of the script file to contain the DDL statements for creating the
objects to be exported and the INSERT statements if you will also be exporting data
(for example, my_tables.sql). You can click Browse to select a directory for this file.
(The default file path for export operations is specified in the SQL Developer user
preferences for Database.)
Connection: Select the database connection with the objects to be exported.
DDL Options: Options that affect the DDL statements in the output file:
■ Show Schema: If this option is checked, the schema name is included in CREATE
statements. If this option is not checked, the schema name is not included in
CREATE statements, which is convenient if you want to re-create the exported
objects under a schema that has a different name.
■ Storage: If this option is checked, any STORAGE clauses in definitions of the
database objects are preserved in the exported DDL statements. If you do not want
to use the current storage definitions (for example, if you will re-create the objects
in a different system environment), uncheck this option.
■ Terminator: If this option is checked, a line terminator character is inserted at the
end of each line.
■ Pretty Print: If this option is checked, the statements are attractively formatted in
the output file, and the size of the file will be larger than it would otherwise be.
■ Include BYTE Keyword: If this option is checked, column length specifications
refer to bytes; if this option is not checked, column length specifications refer to
characters.
■ Add Force to Views: If this option is checked, the FORCE option is added to any
CREATE VIEW statements, causing each view to be created even if it contains
errors.
■ Include Drop Statement: If this option is checked, a DROP statements is included
before each CREATE statement, to delete any existing objects with the same
names. However, you may want to uncheck this option, and create a separate
drop script that can be run to remove an older version of your objects before
creation. This avoids the chance of accidentally removing an object you did not
intend to drop.
■ Include Grants: If this option is checked, GRANT statements are included for any
grant objects on the exported objects. (However, grants on objects owned by the
SYS schema are never exported.)
Format tab
Format: Determines the format of entries written in the specified output file: CSV for
comma-separated values including a header row for column identifiers, Fixed for a file
where records are the same byte length, HTML for an HTML file containing a table
with the data, Insert for SQL INSERT statements, Loader for a SQL*Loader control file,
Text for a text file, TTBulkCP for a data files to be used with the TimesTen ttbulkcp
command line utility, XLS for a Microsoft Excel worksheet, or XML for XML tags and
data.
For exporting large tables to Microsoft Excel files:
■ If you encounter problems, try adding the following line to the sqldeveloper.conf
file to increase heap size and then restarting SQL Developer: AddVMOption
-Xmx1024M
■ If the number of table rows exceeds 65,536, SQL Developer writes the rows to
multiple worksheets within the .xls file.
Output: File writes the output to a file that you specify; Clipboard places the output
on the system clipboard, so that you can paste it into a file, a command line, or other
location appropriate for the format.
File: If the output is to a file, click Browse to select the directory or folder and to
specify the file name and extension. The file path is then placed in the File box. (The
default file path for export operations is specified in the SQL Developer user
preferences for Database.) Standard file extensions include .sql for Insert format, .xls
for Microsoft Excel format, .xml for XML format, .ctl for SQL LOADER format, and
.csv for CSV format.
Columns tab
You can specify whether the output should include data from all columns or just from
the checked columns. (Note: For CLOB columns, only the first 32 KB of any CLOB is
exported.)
Where tab
You can restrict the output by entering a valid WHERE clause for a query on the table,
without the WHERE keyword. For example, to restrict the exported data to rows
where a column named RATING contains a value greater than 5, specify: rating >
5
Display Options
Specify how the external tool should appear when displayed in menu or toolbar items.
Caption for Menu Items: The text string that will appear for any menu item that calls
the external tool. To indicate the mnemonic character, use the ampersand before the
character. For example: &Mytool for the "M" to be underlined and used as the
mnemonic
ToolTip Text: Text for the tooltip to be displayed when the mouse pointer hovers over
the icon for the tool in a toolbar.
Icon Location: File path of the icon associated with the tool. Click Browse to specify a
graphics file, or Use Default to use the default icon (if you previously specified a
nondefault icon).
Preview: A read-only display of the menu item and its associated icon.
Integration Options
Specify how the external tool will be integrated with SQL Developer.
Add Items to Menus: Check any menus on which you want to include an item for this
tool.
Add Buttons to Toolbars: To add the icon for this tool to the SQL Developer main
toolbar, check Main Toolbar.
After Tool Exits: To have SQL Developer reload any open files after the tool exits,
check Reload Open Files.
Availability Options
Specify when the external tool is enabled. In contexts where the tool is not enabled, its
menu item and icon are grayed out.
Always: Makes the tool always available.
When a File is Selected or Open in the Editor: Makes the tool available only when a
file is selected or open, such as when the SQL Worksheet is open.
When Specific File Types are Selected: Makes the tool available only when files of the
specified type or types are selected. Use the arrow buttons to move desired types from
Available Types to Selected Types.
Platform: The IDM DB2, MySQL, Microsoft SQL Server, or Sybase Adaptive Server
version for which to generate the scripts.
5.70 Filter
This dialog box is displayed when you right-click a connection node or an object type
node (such as Tables) in the Connections navigator and select Apply Filter. Use this
box to limit the number of objects of that type that are displayed, according to one or
more filter criteria that you specify. For each criterion, specify the following:
■ Criterion name (list always includes NAME; other criteria depend on the object
type)
■ Operator (for example, LIKE)
■ Value for comparison (for example EM%)
■ Case-sensitive option for character data comparison
For example, to display only tables with names that start with EM, specify NAME, LIKE,
and EM% (with the percent sign as a wildcard character).
Override Schema Filter (object type node filters): If this option is checked, any filter
criterion specified at the connection level is ignored, and only the object type node
filter criteria are applied.
Include Synonyms (object type node filters): If this option is checked, synonyms for
objects of this object type are included.
To add another filter criterion, click the Add (+) icon; to delete a criterion, select it and
click the Delete (X) icon; to move a criterion up or down in the list, select it and use the
arrow icons.
To apply the filter criteria to the Connections navigator display, click OK.
To remove the effects of applying a filter, right-click the object type node in the
Connections navigator display and select Clear Filter.
Available Object Types: Lists the types of objects that are available to be added to the
display.
Displayed Object Types: Lists the types of objects that are included in the display.
To add a type of object to the display, select it in Available Object Types and click the
Add (>) icon; to remove a type of object from the display, select it in Displayed Object
Types and click the Remove (<) icon. To move all types of objects from available to
displayed (or the reverse), use the Add All (>>) or Remove All (<<) icon.
incorporated into them. A patch must be applied to the same revision/tag from which
it was generated.
Source Files or Project: Name and location of the project or set of files will be the
subject of the patch.
Patch Target: Where the generated patch will be sent: System Clipboard (from which
you can paste the patch), File (accept the shown name and location, or specify
different ones), or Open Patch File Editor (where you can edit and then save it).
Output Format: One of the standard diff formats: Unified, Context, or Standard.
5.82 Go to Bookmark
Use this box to specify the bookmark to go to in the selected function or procedure.
After you enter the bookmark and click Go, the line associated with that bookmark is
highlighted.
Module
Select the connection name, enter a name for the module, and optionally enter a
descriptive comment about the import operation.
Tags
Select the connection name, enter a name for the module, and optionally enter a
descriptive comment about the import operation.
Sources
Source Folder: Location from which files will be copied for the import operation.
Filters
You can configure filters to be used for excluding folders and files from the import
operation. Use the arrow keys to move selected filters or all filters between Available
Filters and Selected Filters.
To create a filter and add it to the Selected Filters list, click New to display the Create
Filter dialog box.
Options
You can specify options to be used during the import operation.
Use File Modification Time: If this option is checked, the file's modification time is
used as the time of import. If this option is not checked, the time when the import
operation is performed is used as the time of import.
Perform Module Checkout: If this option is checked, the modules are checked out
after they are imported.
Summary
You can review the information that will be used to perform the import operation.
To go back and make any changes, click Back as needed.
To perform the import operation, click Finish.
5.98 Paste
This dialog box is displayed if you click Edit, then Extended Paste. It shows a list of
clipboard items, so that you can select the content to be pasted. Click OK to paste the
selected content into the current location.
Clipboard Items: Clipboard items with content from copy operations. Usually
displays the first line of the content.
Item Content: The content of the selected clipboard item.
Select Columns
Use the Select Columns tab to select tables and views, then columns within them, to be
used in the query. Use the connections tree on the left to find the desired tables and
views under the appropriate schema or schemas, and double-click each desired table
and view.
Within each selected table or view, click to select the desired columns (all or specific
ones) to include in the query.
Show SQL
Use the Show SQL tab to see a read-only display of the query reflecting what you have
specified so far.
View Results
Use the View tab to test the query in its current form. Click the Execute Statement icon
to execute the query.
Refresh: Specifies the refresh interval: the number of seconds between each time the
query is automatically re-executed and the results display is updated. A value of zero
(0) means that the query is not automatically re-executed after the initial execution.
Definition tab
Specify the definition of the breakpoint.
Breakpoint Type: Type of breakpoint, indicating when the breakpoint will occur.
Options include breaking when one of the following occurs: a specific line of code
(Source); exception class or other class; method, file, or watch.
Breakpoint Details: Options depend on the breakpoint type.
Breakpoint Group Name: Breakpoint group in which to include this breakpoint.
Breakpoint groups can be edited, enabled, and disabled.
Conditions tab
Specify any conditions that apply to the breakpoint.
Condition: A SQL condition (WHERE clause without the WHERE keyword)
restricting when the breakpoint occurs. For example, to specify that the condition
should occur only when status_code is greater than 10, specify:
status_code > 10
Thread Options: You can specify whether the breakpoint occurs for all threads, or
only when the breakpoint is hit by threads that either do or do not have a specified
name.
Pass Count: The number of times the debugger should allow execution to pass over
the breakpoint before the breakpoint occurs.
Actions tab
Specify the actions to be taken when the breakpoint occurs. The options you specify
override any default values on the Debugger: Breakpoints: Default Actions pane for
SQL Developer Preferences.
Halt Execution: Pauses execution when the breakpoint occurs.
Beep: Beeps when the breakpoint occurs.
Log Breakpoint Occurrence: Sends a message to the log window when the breakpoint
occurs. You can also specify the following to be included in each display: a tag, and a
condition to be evaluated.
Enable/Disable a Group of Breakpoints: Enables or disables the specified breakpoint
group when this breakpoint occurs.
Add New Rule: Displays the Add/Edit Rule dialog box, for specifying a mapping for
another data type.
Edit Rule: Displays the Add/Edit Rule dialog box, for editing the selected mapping.
Remove Rule: Deletes the selected mapping.
Depth: The level of recursion for selecting files to be checked out, from Infinity (all
children at all levels under the selected item in the Versioning browser hierarchy(
through Empty (only this item and no children).
Destination
Use to identify the Subversion repository, and directory within the repository, where
the imported files will be stored.
Repository Connection: The connection for the Subversion repository in which you
wish to store the imported files
Path: The directory within the Subversion repository for storing the imported files.
Source
Source Directory: The directory containing the source files that you want to import
into Subversion. Initially contains a path based on the item that was selected when you
launched the wizard.
Comments: Comment text to accompany the imported files. The comments are
recorded with the files in the Subversion repository and will be viewable with the
version history of the files. You must enter some comment text; otherwise, an error
will occur when you click Finish to attempt to perform the import operation.
Filters
Filters that will be applied to the import operation. If you do not want one or more of
the filters to be applied, move them from Selected Filters to Available Filters using the
left arrow keys. If necessary, you can use the right arrow keys to move filters from
Available Filters to Selected Filters.
New: Displays a dialog box in which you can create a new filter that will be applied to
the import operation. New filters are added to the Selected Filters list.
Options
You can configure options specific to the import operation.
Do Not Recurse: If this option is enabled, it prevent files being imported from
directories subordinate to the one you identified on the Source page.
Perform Checkout : If this option is enabled, the imported source files will be checked
out after import.
Summary
Displays the selected options for the import operation. To make any changes, click
Back. To perform the operation, click Finish.
bring another developer's work into your own files, and to merge private
development back into the main line of development.
The merge is created by comparing the content of two revisions within the Subversion
repository, and applying the differences to a Subversion working copy. If you
subsequently wish to use the result of the merge in the main line of development, you
commit the working copy to the Subversion repository in the usual way.
Specify the following:
■ Merge Type: Merge Selected Revision Range, Reintegrate a Branch, or Merge Two
Different Trees.
■ Merge Resource
■ Merge Options
Your selection for Merge Type affects the content of subsequent displays, which can
include the following.
From URL and its (start) revision to merge: The resource that is the basis of the
comparison. (The resource entered in the To URL box will be compared against the
resource entered here.)
HEAD Revision from Repository: Causes the comparison to be made against the
most recently committed resources in the Subversion repository.
Use Revision: Causes the comparison to be made against a resource in the Subversion
repository with a particular revision number. When selected, the accompanying text
box becomes available. You can then enter a revision number into the text box, or click
the List Revisions button to select the revision that you require.
To URL and its (end) revision to merge: The resource that will be compared with the
base resource selected in the From URL box.
Same as "From" URL: Uses the same base repository location for both elements of the
comparison.
Ignore Ancestry: Ignores any relationships between resources in the Subversion
repository when comparing the start and end revisions. The effect of this will be to
retain resources that have names identical to those they are being compared with, even
though the resources have no common ancestry. The alternative is that a resource that
predates an identically named one may be deleted and replaced with the later
resource.
Dry Run: Causes the comparison to be performed without the changes being applied
to the Subversion working copy. The results of the comparison are displayed in the
Messages - Log window.
Use Revision: Causes the revision specified in the text box to be used for the update
operation. To see a list of revisions from which you can choose, click List Revisions.
Select Operation
Select a database connection on the right, then use the hierarchy tree to select an object
to be tested. For example, to test a procedure, expand the Procedures node and select
the desired procedure.
Specify Startup
Specify the action to perform at the start of the test, before any of the actual test
operations are performed. Reasons for using a startup action might include the
following:
■ You want to create copies of the entire table or specific rows that will be modified
by the test, so that you can restore the original values later during teardown.
■ You want to perform some special operations before the test is run.
None: Perform no startup action.
Row Copy: Copy rows from a specified table. You will be asked to specify the table
and q query for selecting the rows.
Table Copy: Copy a specified table. You will be asked to specify the table. For
example, you might want to copy the EMPLOYEES table to a table named
EMPLOYEES_ORIGINAL.
User PL/SQL Code: Run a script. You will be asked to specify the script file.
Specify Parameters
If you are creating a single test case, specify the parameter values in the Input column
for each input parameter. For example, for the example award_bonus procedure, you
might test the case where employee ID 1001 sold 5000 dollars work of goods or
services (EMP_ID Input: 1001, SALES_AMT Input: 5000).
If you are creating multiple test cases, specify the information for each parameter for
each test case. For example, to create a test with 5 test cases for the example award_
bonus procedure, you need to enter 10 rows on this page (2 input parameters times 5
test cases).
Specify Validations
Specify one or more validation actions to perform after the test case is run, to check
whether the desired result was returned. For example, if a test case for a procedure
was supposed to increase the salary for employee number 1001 to $2000, specify a
Query returning row(s) validation of SELECT salary FROM employees
WHERE employee_id = 1001 AND salary = 2000.
For all validation action options except None, you will be prompted to specify the
required information.
To add a validation action for a test case, click the Add (+) icon; to delete a validation
action for a test case, select it and click the Remove (X) icon.
None: Perform no validation action.
Boolean function: Validation succeeds if Boolean TRUE is returned by the specified
function.
Query returning no row(s): Validation succeeds if the specified query returns no
rows.
Query returning row(s): Validation succeeds if the specified query returns one or
more rows that satisfy the specified query.
Result Set Compare: Validation succeeds if the results returned by the specified query
match the values that you specify.
Table Compare: Validation succeeds if the target table (the table modified by the test
case) is identical to the specified table.
User PL/SQL Code: Validation succeeds if the specified script runs successfully.
Specify Teardown
Specify the action to perform after the validation action (or the test case in no
validation action was specified) is finished. Reasons for using a teardown action might
include the following:
■ You want to restore a table to its original values, effectively "rolling back" any
changes that were made by the test case.
■ You want to perform some special operations after the test is run.
None: Perform no teardown action.
Table Drop: Drop (delete) the specified table.
Table Restore: Replace all rows in the specified target table (the table modified by the
test case) with the rows in the specified source table. For example, you might want to
replace the contents of EMPLOYEES (target) table with a source table named
EMPLOYEES_ORIGINAL.
User PL/SQL Code: Run a script. You will be asked to specify the script file.
Summary
Displays the selected options for the application to be deployed or imported. To make
any changes, click Back. To perform the operation, click Finish.
5.173 Windows
This dialog box is displayed if you right-click the tab for a window in the display area
of the SQL Developer main window.
Windows: A list of the windows in the display area.
Index-1
Microsoft SQL Server, 5-9 remote debugging, 1-27
MySQL, 5-8 decryption
Oracle Database, 5-5 data in a table column, 1-17
Oracle TimesTen, 5-7 deployment
separate unshared worksheet for, 1-21, 1-29 after database migration, 2-29
Sybase Adaptive Server, 5-9 destination schema
Teradata, 5-9 database schema differences, 5-40
using folders to group, 1-21 dialog boxes and tabs, 5-1
constraints directories (directory objects), 1-11
check, 5-22 disabled constraints, 1-44
disabled, 1-44 discussion forum
unique, 5-21 SQL Developer, 1-71
converted model documentation
correcting errors in, 2-19 generating for schema, 1-21
creating and customizing, 2-18 downloads
Create Local Connections command, 1-20 SQL Developer, 1-71
Create Unit Test wizard, 5-72 drag and drop effects, 1-53
customizing SQL Developer drivers
setting preferences, 1-48 third-party JDBC, 1-55
CVS (Concurrent Versions System) dynamic HTML
preferences for, 1-63 user-defined report example, 1-47
SQL Developer support for, 1-37
E
D editions, 1-11
data embedded PL/SQL gateway (EPG) for Application
entering and modifying, 1-23 Express
data move starting and stopping, 1-11
generating user, 1-61 encryption
number of parallel streams, 1-60 data in a table column, 1-17
options, 1-59 entering data in tables, 1-23
data types EPG (embedded PL/SQL gateway) for Application
creating, 5-30 Express
database connections, 5-9 starting and stopping, 1-11
creating, editing, or selecting, 5-5 errors
explanation, 1-19 parse exceptions, 2-19
IBM DB2, 5-8 Excel
JDBC, 5-8 importing data, 5-11
Microsoft Access, 5-7 execution plan, 1-33
Microsoft SQL Server, 5-9 expired password
MySQL, 5-8 resetting, 1-21
Oracle Database, 5-5 EXPLAIN PLAN
Oracle TimesTen, 5-7 execution plan, 1-33
Sybase Adaptive Server, 5-9 exporting
Teradata, 5-9 applying filters, 5-45
database links, 1-11 database objects, 5-43
creating or editing, 5-12 reports, 1-39
database objects, 1-10 table data, 1-17, 5-45
exporting, 5-43 unit test objects, 3-10
finding (searching for), 1-37 expression watches, 1-28
database schema differences extensions, 5-47
differences between two database schemas, 5-40 SQL Developer, 1-58
DB2 user-defined, 1-56
before migrating, 2-12 external editor
DB2 (IBM) connections, 5-8 SQL Developer preferences, 1-58
DBMS_OUTPUT external tables
user-defined report example, 1-47 properties, 5-26
DBMS_OUTPUT pane, 1-33 external tools, 1-8, 5-46, 5-47
debugging PL/SQL function or procedure, 1-25
dialog box, 5-58
Index-2
F I
F10 key IBM DB2
for File menu, 1-3 before migrating, 2-12
F4 key, 1-31 IBM DB2 connections, 5-8
failed objects IDE_USER_DIR location, 1-66
generating, 1-61 implementation
file types adding for a unit test, 5-71, 5-72
associating with SQL Developer, 5-38 importing
file-oriented development Microsoft Excel data, 5-11
SQL Worksheet right-click operations, 1-30 reports, 1-39
Files navigator, 1-4 unit test objects, 3-10
filter indexes, 5-22
applying, 1-4, 5-49 coalescing, 1-12
clearing, 1-4, 5-49 creating or editing, 5-13
finding database objects, 1-37 explanation, 1-12
Flashback Table support, 1-17 making unusable, 1-12
folders rebuilding, 1-12
for user-defined reports, 1-45, 5-32 index-organized tables
in Connections navigator, 1-21 properties, 5-26
font introduction
increasing or decreasing size for help text, 1-68 SQL Developer, 1-1
foreign keys, 5-21
Freeze View
J
pinning an object’s display, 1-5, 1-23, 1-39
FROM clause, 5-34 Java sources, 1-13
full pathname for java.exe, 1-2 java.exe
functions pathname for, 1-2
compiling, 1-12, 1-14 JDBC connections, 5-8
compiling for debug, 1-12, 1-14 JDBC drivers, 1-55
creating, 5-16 jobs, 1-13
debugging, 5-58 jTDS
running, 5-58 JDBC driver for Microsoft SQL Server and Sybase
Adaptive Server, 1-55
G
K
Gather Code Coverage Statistics option, 3-5
Gather Schema Statistics menu command, 1-21 Kerberos authentication, 5-6
gauges Database Advanced Parameters, 1-52
in SQL Worksheet and user-defined reports, 1-35 keyboard shortcuts, 1-62
generate data move user option, 1-61
Generate DB Doc menu command, 1-21 L
generate failed objects option, 1-61
graphical user interface (GUI), 1-2, 2-31 least privilege schema migration, 1-61
unit testing, 3-2 library
GROUP BY clause, 5-35 adding an item for unit testing, 5-71
groups unit testing, 3-9
connections in folders, 1-21 link
database, 5-12
LOB parameters, 5-23
H local connections
HAVING clause, 5-35 creating, 1-20
help locking a table, 1-16
increasing or decreasing help text font size, 1-68 lookups
using the online help, 1-68 adding for unit testing, 5-71
hierarchical profiler (PL/SQL), 1-28 lowercase characters in object names
HTML quotation marks required, 5-1
dynamic (user-defined report), 1-47
M
materialized view logs, 1-13
Index-3
creating and editing, 5-14 using, 1-68
materialized views, 1-13 open SQL Worksheet automatically
options when creating or editing, 5-36 preference for database connections, 1-56
Microsoft Access operating system authentication, 5-6
capturing using exporter tool, 2-15 Oracle Application Express
configuring before migrating, 2-14 applications, 1-10
creating data files, 2-20 Oracle By Example (OBE) lessons, 1-71
turning off security, 2-14 Oracle Database connections, 5-5
Microsoft Access connections, 5-7 Oracle Web Agent (OWA), 1-34
Microsoft Excel ORDER BY clause, 5-35
importing data, 5-11 OS authentication, 5-6
Microsoft SQL Server, 2-13 OTN page
connections, 5-9 SQL Developer, 1-71
creating data files, 2-20 overview
third-party JDBC drivers, 1-55 SQL Developer, 1-1
migration OWA_OUTPUT pane, 1-34
architecture, 2-5
before you start (general), 2-10
P
before you start (source-specific), 2-12
deployment after migrating, 2-29 packages
introduction and main topics, 2-1 creating, 5-15
overview, 2-5 debugging, 5-58
planning for, 2-6 running, 5-58
quick start, 2-1 parallel data move streams, 1-60
required roles and privileges, 2-11 parameter insight, 1-50
migration plan parse exception errors, 2-19
preparing, 2-6 partitioned tables
migration repository partition definitions, 5-26
creating database user for, 2-11 partitioning options, 5-25
MIME type subpartitioning options (templates), 5-25
specifying external editor for BLOB data, 1-58 password
MOD_PLSQL resetting expired, 1-21
OWA output, 1-34 pathname
modifying data in tables, 1-23 for java.exe, 1-2
Monitor Sessions command, 1-8 pinning an object’s display, 1-5, 1-23, 1-39
Monitor SQL command, 1-8 PL/SQL hierarchical profiler, 1-28
moving a table to another tablespace, 1-17 PL/SQL packages
MySQL creating, 5-15
configuring before migrating, 2-15 PL/SQL subprograms
creating data files, 2-20 creating, 5-16
third-party JDBC drivers, 1-55 debugging, 5-58
MySQL connections, 5-8 breakpoints, 5-59
zero date handling, 5-8 running, 5-58
plsql-dbms_output
user-defined report example, 1-47
N preferences
normalizing customizing SQL Developer, 1-48
column data, 1-17 preferences (options), 1-63
primary key, 5-20
private database links, 1-11
O
private synonyms, 1-16, 5-17
OBEs (Oracle By Example lessons), 1-71 privileges
objects required for migration, 2-11
database, 1-10 procedures
exporting, 5-43 creating, 5-16
OCI driver profiler (PL/SQL hierarchical), 1-28
database advanced parameters preference, 1-53 profiling a PL/SQL function or procedure, 5-58
offline data transfer, 2-19 projects
offline generation of Oracle DDL, 5-51 creating plan, 2-9
online help proxy authentication, 1-22
Index-4
proxy connections, 1-22, 5-6 running, 1-32
public database links, 1-11 search
public synonyms, 1-16, 5-17 for database objects, 1-37
Publish to Apex (Application Express) option, 1-24 security
Advanced Security for JDBC connection, 1-22
SELECT clause, 5-34
Q
sequences, 1-16
query builder, 5-56 creating and editing, 5-16
quotation marks for populating table columns, 5-23
for name with lowercase characters, special sessions
characters, or spaces, 5-1 monitoring, 1-8
shared reports, 1-39
R shared repository, 3-4
shortcut keys, 1-62
Raptor for menus, 1-3
former code name for SQL Developer, 1-1 restoring to default scheme, 1-62
read-only data modeling viewer, 1-67 shrinking a table, 1-17
rebuilding an index, 1-12 single record view, 5-62
recompiling size of help text
view, 1-18 increasing or decreasing, 1-68
Recycle bin, 1-15 snippets, 1-36
refactor in bulk, 1-10 user-defined, 1-36
remote debugging, 1-27 source database
replication schemes, 1-15 capturing, 2-16
report navigator, 1-39 source schema
reports, 1-39 database schema differences, 5-40
bind variables for, 1-40 spaces in object names
exporting, 1-39 quotation marks required, 5-1
importing, 1-39 special characters in object names
shared, 1-39 quotation marks required, 5-1
unit testing, 3-10 split
user-defined data pane for a table or view, 1-25
chart example, 1-46 SQL
creating and editing, 5-31 monitoring execution, 1-8
dynamic HTML example, 1-47 SQL Developer preferences, 1-48
explanation, 1-45 SQL file
folders for, 1-45, 5-32 creating, 5-17
gauge example, 1-35 SQL scripts
UserReports.xml, 1-45 running, 1-32
repository SQL Server
unit test, 3-4 configuring, 2-13
Reset Password menu command, 1-21 creating data files, 2-20
roles third-party JDBC drivers, 1-55
required for migration, 2-11 SQL Server connections, 5-9
running PL/SQL function or procedure, 1-25 SQL Trace files (.trc), 1-27
dialog box, 5-58 SQL Worksheet
closing automatically on disconnect, 1-57
S opening automatically on database
connection, 1-56
schema
unshared for a connection, 1-21, 1-29
XML, 1-19, 5-38
using, 1-28
schema differences
Start Page for SQL Developer, 1-71
differences between two database schemas, 5-40
statistics
schema documentation
computing table and column, 1-17
generating, 1-21
estimating table and column, 1-17
schema objects, 1-10
gathering schema, 1-21
schema statistics
storage options, 5-27
gathering, 1-21
stored procedures
scratch editor, 2-34
generating for Migrate Blobs Offline, 1-61
script runner, 1-32
subpartitions
scripts
Index-5
templates, 5-25 database connections, 5-7
subprograms replication schemes, 1-15
creating, 5-16 support for in SQL Developer, 1-67
debugging, 5-58 Tip of the Day, 1-68
running, 5-58 TKPROF
substitution variables, 1-32 opening in SQL Developer as an alternative to
Subversion using, 1-27
preferences for, 1-65 tnsnames.ora file, 1-19
SQL Developer support for, 1-37 tools
Sybase Adaptive Server, 2-13 external, 1-8, 5-46, 5-47
connections, 5-9 trace files (.trc), 1-27
creating data files, 2-20 transferring
third-party JDBC drivers, 1-55 data offline, 2-19
synonyms, 1-16 translation scratch editor, 2-34
creating and editing, 5-17 .trc files, 1-27
triggers, 1-18
creating and editing, 5-28
T
truncating a table, 1-16
tables, 1-16 T-SQL
analyzing, 1-17 not supported in worksheet for SQL Server or
compacting, 1-17 Sybase connection, 2-34
computing statistics, 1-17 translation to PL/SQL, 2-34
creating and editing, 5-19 tutorial
creating quickly, 5-18 creating objects for a small database, 4-1
decrypting column data, 1-17 types
encrypting column data, 1-17 creating, 5-30
entering and modifying data, 1-23
estimating statistics, 1-17
exporting data, 1-17, 5-45
U
external unique constraints, 5-21
properties, 5-26 unit test
index-organized definition of (as related to test cases), 3-2
properties, 5-26 unit testing, 1-63
locking, 1-16 adding a category for lookups, 5-71
moving to another tablespace, 1-17 adding an implementation, 5-71, 5-72
normalizing column data, 1-17 adding an item to a library, 5-71
partitioned command-line interface, 3-11
partition definitions, 5-26 copying or renaming a unit test, 5-72
partitioning options, 5-25 Create Unit Test wizard, 5-72
subpartitioning options (templates), 5-25 editing and running a unit test, 3-5
shrinking, 1-17 example, 3-11
splitting the data pane, 1-25 exporting objects, 3-10
temporary, 5-19 graphical user interface (GUI), 3-2
truncating, 1-16 importing objects, 3-10
validating structure, 1-17 introduction and main topics, 3-1
temporary tables, 5-19 library, 3-9
Teradata managing users, 5-74
before migrating, 2-16 overview, 3-1
connections, 5-9 reports, 3-10
test case repository, 3-4
definition of, 3-2 tutorial, 3-11
test suite variable substitution, 3-8
definition of, 3-2 unshared worksheet for a connection, 1-21, 1-29
thick (OCI) driver unusable indexes, 1-12
database advanced parameters preference, 1-53 updates
third-party databases checking for SQL Developer updates, 5-2
configuring before migrating, 2-12 user information directory (IDE_USER_DIR), 1-66
third-party JDBC drivers, 1-55 user interface
TimesTen restoring to original settings, 1-9
cache groups, 1-11 user interface (UI), 1-2, 2-31
Index-6
unit testing, 3-2
user-defined extensions, 1-56
user-defined reports
chart example, 1-46
creating and editing, 5-31
dynamic HTML example, 1-47
explanation, 1-45
folders for, 1-45, 5-32
gauge example, 1-35
UserReports.xml, 1-45
user-defined snippets, 1-36
user-defined types
creating, 5-30
UserReports.xml, 1-45
users
creating and editing, 5-30
UT_REPO_ADMINISTRATOR role, 3-4
UT_REPO_USER role, 3-4
UtUtil executable or shell script, 3-11
V
variable substitution
unit testing, 3-8
versioning
preferences for, 1-63
SQL Developer support for, 1-37
viewer (read-only) data modeling tool, 1-67
viewlets
SQL Developer, 1-71
views, 1-18
compiling, 1-18
creating and editing, 5-32
FROM clause, 5-34
GROUP BY clause, 5-35
HAVING clause, 5-35
options when creating or editing, 5-36
ORDER BY clause, 5-35
recompiling, 1-18
SELECT clause, 5-34
splitting the data pane, 1-25
WHERE clause, 5-35
W
watches, 1-28
WHERE clause, 5-35
X
XML DB Repository, 1-18
XML schema, 1-19
creating, 5-38
xUnit frameworks, 3-1
Z
zero date handling
MySQL connections, 5-8
Index-7
Index-8