PL-SQL 2015-Programin

  • Upload
    beruamc

  • View
    222

  • Download
    0

Embed Size (px)

Citation preview

  • 7/23/2019 PL-SQL 2015-Programin

    1/20

    PL/SQL Developerby

    Allroundautomation

    PL/SQL Developer

    The PL/SQL Editor

    Integrated Debugger

    Query Builder

    PL/SQL Beautifier

    SQL Window

    Command Window

    Reports

    Project

    Object Browser

    Performance Optimizing

    HTML Manuals

    Non-PL/SQL Objects

    Template List

    Compare User Objects

    Export User Objects

    Tools

    Export User Objects

    Multi-threaded IDE

    Easy Installation

    Systemrequirements

  • 7/23/2019 PL-SQL 2015-Programin

    2/20

    PL/SQL Developer

    PL/SQL Developer is an Integrated Development Environment that is specifically targeted at the development of storedprogram units for Oracle Databases. Over time we have seen more and more business logic and application logic moveinto the Oracle Server, so that PL/SQL programming has become a significant part of the total development process.PL/SQL Developer focuses on ease of use, code quality and productivity, key advantages during Oracle applicationdevelopment.

    All development tasks can be performed from within PL/SQL Developer's IDE. On the left side you see the ObjectBrowser, which provides access to all database objects that are relevant to PL/SQL development. On the right side yousee a Program Editor, a Table Definition Editor, and a SQL Window.

    The following are major features of PL/SQL Developer:

    Powerful PL/SQL Editor With its Syntax Highlighting, SQL and PL/SQL help, Object Descriptions, Code Assistant,Compiler Hints, PL/SQL Beautifier, Code Contents, Browse Buttons, Hyperlink Navigation, Macro Library and many other

    sophisticated features, the editor will even appeal to the most demanding user. Information is automatically presented toou when you need it, or is at most one click away.

  • 7/23/2019 PL-SQL 2015-Programin

    3/20

    The PL/SQL Editor

    The PL/SQL Editor offers all features you expect from a modern development tool. It provides multi-level undo & redo,bookmarks, block indent & unindent, powerful find & replace with regular expressions, a macro recorder and library,column editing, and more.

    The PL/SQL Editor also offers a wide range of assistance to the programmer. There is context sensitive help throughOracle's on-line HTML Manuals: just press F1 when the cursor is on a keyword to perform an indexed search in yourpersonal selection of manuals.

    Right-click on a database object and you will see a context sensitive Object Popup Menu. From this popup menu you canview the properties or a description of the object. If the object is a program unit, you can view or edit the source. If it is atable or view, you can query or edit the data.

    The Code Assistant automatically provides information about database objects as you type their name. In the screenshotabove you can see that all columns of the emp table are displayed when the cursor is located after the "." of the tablename. You can now select a column name, or continue typing to filter the column list. The Code Assistant will provide aparameter list for functions and procedures, will display a list of all elements of packages, will display a column list fortables and views, and will display all objects owned by a user.

    Compiler Hints will help you increase the quality of your code, and can help you find errors that you would normally onlyfind at run-time. You will receive hints about unused declarations (e.g. a local variable that is not used), unused valueassignments, comparisons with NULL, functions without a return statement, and implicit date conversions.

    The PL/SQL Beautifier allows you to format your PL/SQL code through a user-defined set of rules. Your code canautomatically be beautified when you compile, save, or open a file.

    The Code Contents shows all functions, procedures, variables, constants, types, parameters, and exceptions defined in aprogram unit. This is most useful in large package or type bodies, which can contain thousands of lines of code. You canquickly navigate through such a source file by clicking on an element in the Code Contents.

    The Browse Buttons allow you to browse back and forward between bookmarks that are automatically maintained as younavigate through your PL/SQL code. Whenever you jump to an absolute location, a navigation bookmark is added. Thishappens when you search, click on a compilation error, click in the Code Contents, or move to the start or the end of thesource.

    Hyperlink Navigation allows you to quickly find an object declaration. Press the Control key and click on an object name inthe editor, and you will navigate to its declaration. This can be a variable, a parameter, a type, a function or procedurecall, a view, an exception, and so on.The PL/SQL Editor can also be used to edit Java Source code in an Oracle8i database.

  • 7/23/2019 PL-SQL 2015-Programin

    4/20

    Integrated Debugger(requires Oracle 7.3.4 or later)

    The integrated debugger offers all features you could wish for: Step In, Step Over, Step Out, Run Until Exception,Breakpoints, View & Set Variables, View Call Stack, and so on. You can debug any program unit without making anymodification to it, including triggers and Oracle8 object types.

    The Integrated Debugger is a very powerful tool for those problems that are hard to fix. And yet it is very easy to use. Noextra actions or conversions are needed and no limitations exist. Just execute the program unit in the Debugger and step

    through your code. You can step into any program unit, including triggers and types. Breakpoints can be set or removedby simply clicking in the left margin of the Debugger or Program Editor. You can additionally define conditions andmessages for breakpoints.Variable values can be examined in the Debugger by moving the mouse cursor over the variable name in the source. Inthe screenshot above, the mouse cursor is moved over the 'p_DeptNo' variable and its value is automatically displayed ina popup. You can set the value of a variable in a similar way.When an exception occurs, the Debugger will take you to the line that causes it and you are able to view variable valuesat the time of the exception. This can obviously be very helpful to find the cause of the exception.On Oracle8i or later, you can use the Test Window's Trace facility to trace the execution of your PL/SQL code. You canconfigure which events you want to trace: Calls, Exceptions, SQL, or even every executed line of PL/SQL code.

  • 7/23/2019 PL-SQL 2015-Programin

    5/20

    Query Builder

    The graphical Query Builder makes it easy to create new select statements or modify existing ones. Just drag and droptables and views, select columns for the field list, where clause and order by clause, join tables based on foreign keyconstraint definitions, and you're done.

    The Query Builder can be used from within any editor to create or modify select statements. Simply drag tables and viewsfrom the Object Browser on the left, and drop them into the work area on the right. If foreign key constraints exist betweenthe tables, you are automatically asked if they should be used for join conditions.The columns can be selected for the field list, where clause and order by clause in the bottom section of the QueryBuilder.For a select ... into statement, you can select PL/SQL variables from the context of the PL/SQL Editor that started theQuery Builder. All global and local variables from the PL/SQL program unit can simply be selected from a list.Various preferences affect the layout of the generated select statement, such as alignment, margin, case, and so on.

  • 7/23/2019 PL-SQL 2015-Programin

    6/20

    PL/SQL Beautifier

    The PL/SQL Beautifier allows you to format your SQL and PL/SQL code through a user-defined set of rules. Your codecan automatically be beautified when you compile, save, or open a file. This feature will increase your coding productivityand will improve the readability of your PL/SQL code if you are working in large project teams.

    The PL/SQL Beautifier allows you to format your SQL and PL/SQL code through a user-defined set of rules. Your codecan automatically be beautified when you compile, save, or open a file.This feature will increase your productivity, since you do not have worry about the format of your code when you create it,or reformat it when you make modifications. The PL/SQL Beautifier will also improve the readability of your code, due toits consistency. This is most important when you work in large project teams. If you frequently spend several minutesreformatting your colleague's code before making any real modifications, then you know what we are talking about.

  • 7/23/2019 PL-SQL 2015-Programin

    7/20

    SQL Window

    The SQL Window allows you to enter any SQL statement and view or edit the results in a grid, which supports a QueryBy Example mode to search specific records in a result set. You can easily recall previously executed SQL statementsfrom a history buffer. The SQL editor provides the same powerful features as the PL/SQL Editor.

    With the SQL Window you can execute any SQL statement. You can recall, edit and re-execute all previously executedstatements. For select statements you can view the results in a grid or in a single record form, and can update, insert ordelete records easily. The Query By Example mode makes it easy to search specific records in the result set. The results(or a selection of the results) can also be printed, copied to the clipboard or saved as a CSV, TSV, XML or HTML file.The Linked Query feature makes it easy to query a parent record or child records of the selected record, based on foreignkey definitions. Just press the Linked Query button, select the foreign key from the list, and a query for the correspondingrecord(s) is executed in the same SQL Window or in a new one.The SQL Editor has the same powerful features as the PL/SQL Editor. For optimization purposes you can view theresource usage of each executed SQL statement on the Statisticspage.

  • 7/23/2019 PL-SQL 2015-Programin

    8/20

    Command Window

    To develop and execute SQL scripts you can use PL/SQL Developer's Command Window. This window has the samelook and feel as SQL*Plus, and additionally has a built-in script editor with corresponding syntax highlighting. Now youcan develop your scripts without the "edit script / save it / switch to SQL*Plus / run script" cycle, and without leaving thecomfortable PL/SQL Developer IDE.

    The Command Window can be used to develop and execute SQL scripts, using the familiar SQL*PLus command syntax.The built-in editor is a comfortable environment to develop your scripts, using SQL*Plus, SQL and PL/SQL syntaxhighlighting. It has the same powerful features as the PL/SQL Editor, such as the Code Assistant, the Object PopupMenu, and so on. You can quickly switch between the script editor and the command line by clicking on the tabs at the topof the window.Just like with SQL*Plus you can interactively type single commands and SQL statements on the command line. Errormessages are displayed in red, and the error location is underlined in red as well. This makes it easy to find and identifyerrors.

  • 7/23/2019 PL-SQL 2015-Programin

    9/20

    Reports

    To run reports against your application data or against the Oracle dictionary, you can use PL/SQL Developer's built-inReport functionality. There are a number of standard reports, and you can easily create your own custom reports. Thesecustom reports can be saved in a report file, which can in turn be included in the reports menu. This makes it very easy torun your own frequently used custom reports. You can use the Query Reporterfreeware tool to run your reports withoutPL/SQL Developer, and to run them from the command-line.

    The Report Window is very easy to use, and yet it can provide all information that is available in your own applicationtables or in the Oracle Dictionary in a structured layout that is pleasant to the eye.

    At design-time you merely need to provide a select statement that provides the data. You can of course use the powerfulfeatures of the SQL Editorand the Query Builderto write this select statement.You can use an advanced form of substitution variables in your SQL, so that you can provide some input when the reportis run. For each variable you can specify a description, hint, data type, default value, selection list, checkbox values, andso on.

    After you are satisfied with the query of the report, you can modify the layout of its result set. You can define master/detailand break structures, change colors, fonts, alignment, descriptions, and so on. The layout is formatted in HTML, whichallows you to use any HTML and CSS attributes. You can use a Style Library to define commonly used report styles.The report results can be saved in an HTML file, so that you can view it through a Browser at a later time, or include it in adocument, or send it to others. The design-interface of the report will be hidden when you run a report, so that you canfocus on the information.

    The security options of a report allow you to provide reports to others that need to be executed through a privilegedOracle account (e.g. SYS), without providing the password of this account.

  • 7/23/2019 PL-SQL 2015-Programin

    10/20

    Projects

    To organize your work you can use PL/SQL Developer's built-in project concept. A project consists of a collection ofsource files, database objects, notes, and options. It allows you to work within the scope of a specific set of items, insteadof a complete database or schema. This makes it easy to find the project items you need, to compile all project items, orto move a project from one location or database to another.

    The project keeps track of a lot of project specific information. You can define how you want to connect when this projectis opened, you can define the items that make up the project, you can keep notes for the project, and the desktopconfiguration is maintained. If you reopen a project, all items that were opened when the project was previously closed willbe opened at the same position.The project items can be source files of PL/SQL program units, Test Scripts, SQL Scripts, Reports, and so on. A projectitem can also be an object that is stored in the database, and that does not have a representation in a source file. Foreach item you can define if it should be included in the compilation process of the project.

  • 7/23/2019 PL-SQL 2015-Programin

    11/20

    Object Browser

    This configurable tree-view displays all information that is relevant to PL/SQL development. Use it to get objectdescriptions, to view object definitions, to create test scripts for the debugger, to enable and disable triggers andconstraints, to recompile invalid objects, to query or edit table or view data, to search for text in object sources, to dragand drop object names into an editor, and so on. The Object Browser additionally displays dependencies among objects,and lets you recursively expand these dependant objects (e.g. package references view, view references table, and sonon).

    You can keep the Object Browser available at all times in PL/SQL Developer. It gives you access to all information that isrelevant to PL/SQL development:

    Create, duplicate, view, edit, rename and drop objects.

    View properties and descriptions of functions, procedures, packages, types, triggers, java sources, tables,constraints, indexes, views, sequences, and so on.

    View reference information: which objects are referenced by an object, and which objects does an objectreference. You can also quickly compile all referencing objects that have become invalid.

    Enable and disable triggers and constraints.

    View user privileges, role privileges and synonyms for all objects.

    Query and edit the data of tables and views.

    Find objects by searching for text in the database source.You can configure which objects are visible in the Object Browser by defining Browser Filters. You can easily switchbetween these filters with a dropdown list. In the screenshot to the left a filter called 'My objects' is used, which displays allobjects that are owned by the current user.You can also configure which object types (folders) are be visible in the Object Browser, and in which order they appear.The 'Recent Objects' folder makes it easy to find objects you have recently used.

  • 7/23/2019 PL-SQL 2015-Programin

    12/20

    Performance Optimizing

    1. PL/SQL ProfilerTo optimize the performance to your SQL and PL/SQL code, you can use the PL/SQL Profiler to view timinginformation of each executed line of PL/SQL code (Oracle8i and later). Furthermore you can automatically getstatistics on executed SQL statements and PL/SQL programs. These statistics can include CPU usage, block I/O,record I/O, table scans, sorts, and so on.

    The PL/SQL Profiler is a very powerful tool to help you optimize your PL/SQL code, which is available on Oracle8i andlater. For each executed line of code, the total time, maximum time, minimum time, and the number of occurrences will bedetermined.The Profiler is easily accessible in the Debugger's Test Window. Before executing a Test Script, simply press the CreateProfiler report button on the toolbar. If you subsequently execute the script, you can switch to the Profiler page to view thereport.

    2. StatisticsIn the SQL Windowand in the Debugger's Test Windowyou can use the Statistics page to view the resources used by thelast executed SQL statement or program unit. This information can be a big help when optimizing your SQL or PL/SQL

    code. Make a change, re-execute it, and view the statistics to determine the effects.The screenshot above is an example of the statistics you may expect. You can use a preference setting to add anystatistic that Oracle provides. The statistics that are available depend on the version of the Oracle Server you are using.

  • 7/23/2019 PL-SQL 2015-Programin

    13/20

    HTML Manuals

    Oracle currently supplies on-line manuals in HTML format. You can integrate these manuals into PL/SQL Developer'senvironment to provide context sensitive help during editing, compilation errors, and runtime errors.

    PL/SQL Developer can provide context sensitive help through Oracle's on-line HTML Manuals in three ways:

    In the PL/SQL Editorand SQL Editoryou can press F1 to search for the currently selected word.

    In the PL/SQL Editor you can double-click on a compilation error to jump to the corresponding paragraph in theError Messages manual. The screenshot above is an example of this.

    Whenever a runtime error occurs, a Help button allows you to jump to the corresponding paragraph in the ErrorMessages manual.

    You can make a selection of manuals that you want to use for context sensitive help. Manuals that are typically relevantduring PL/SQL Development are the SQL Reference, PL/SQL Reference, Error Messages, Application Developer's Guideand Server Reference. With the proper manual selection, all information that you need is immediately available

  • 7/23/2019 PL-SQL 2015-Programin

    14/20

    Non-PL/SQL Objects

    You can view, create and modify tables, sequences, synonyms, libraries, directories, users and roles without using anySQL. Just enter the information in an easy to use form, and PL/SQL Developer will generate the appropriate SQL tocreate or alter the object.

    During PL/SQL development you will often want to view, modify or create other objects. For tables, sequences,synonyms, libraries, directories, users and roles you can do so without using any SQL. Simply right-click on an object inthe Object Browseror in your source file, and select 'View' or 'Edit' from the popup menu.

    After creating a new object, or after making changes to an existing object, the SQL statements to apply these changes tothe databases can be viewed, edited, copied, saved or exported to a Command Window. You can of course also executethe SQL by pressing the 'Apply' button.The screenshot above shows the columns page of table definition editor for table EMP.

    Template List

  • 7/23/2019 PL-SQL 2015-Programin

    15/20

    PL/SQL Developer's Template List can be a real time-saver and can help you enforce standardization. Whenever youneed to insert some standard SQL or PL/SQL code into an editor, and whenever you need to create a new program filefrom scratch, just click on the corresponding template.

    Templates are a powerful feature to quickly insert standard SQL and PL/SQL code into an editor, or to create a newprogram unit. This will not only save time (you don't need to lookup the syntax anymore), but it will also enforcestandardization. PL/SQL Developer comes with a number of pre-defined templates, but you can also define your owntemplates. They are organized in a hierarchical structure, so that you can easily find the template you need. A templatecan prompt a user to specify the values of certain variables. These variables can be represented as check boxes andsuggestion lists, which in turn can be populated by queries. You can also use pre-defined variables such as the date,

    time, user, and so on.

  • 7/23/2019 PL-SQL 2015-Programin

    16/20

    Compare User Objects

    After making changes to table definitions, views, program units, and so on, it may be useful to propagate these changesto another database user, or to find out what exactly the differences are. This maybe another development environment, atesting environment, or a production environment. The Compare User Objects function allows you to compare a selectionof objects, to visualize the differences, and to execute or save a SQL script that will apply the necessary changes.

    On the Selection tab page you can select the objects you wish to compare. After making this selection, you can select theuser and database that you want to compare. When the compare operation is finished, the dialog will switch to theDifferences tab page, which will show a list of all objects that are different. This list is sorted in order of dependency.Below the list of different objects of the target user, you see the SQL that needs to be executed to apply the changes. Inthe example above, the ENAME column was changed, and the EMP_MGR_FK foreign key constraint andEMP_MGR_CHECK check constraint were added to the EMP table.You can display a visual line-by-line difference of the old and new source file of an object. This can be useful to view thechanges made in Program Units, or can help you determine why a specific DDL statement was generated for other objecttypes. You can configure which difference tool should be used. The ExamDiff utility is distributed with PL/SQL Developer,and will be used by default:

    Now you can see what the exact difference between the 2 object versions is, and why the DDL was generated by theCompare User Objects tool.

  • 7/23/2019 PL-SQL 2015-Programin

    17/20

    Export User Objects

    To export the DDL (Data Definition Language) statements of a selection of objects of a user, you can use the Export UserObjects tool. This way you can easily recreate the objects for another user, or you can save the file(s) as a backup.

    After selecting the objects you wish to export, and selecting an output file, you can press the Export button to export theobjects.The output file is a SQL script that is compatible with Oracle's SQL*Plus, and with PL/SQL Developer's CommandWindow. The Include Privileges option can be enabled if you want to include the grants of the object privileges to otherusers and roles.You can control whether a single SQL script is created that contains the DDL for all objects, or if each object should beexported to a specific file (with the object name as filename, and .sql as extension). In that case the output file will containa series of calls to these object specific files.

    Tools

  • 7/23/2019 PL-SQL 2015-Programin

    18/20

    PL/SQL Developer includes several tools to make everyday development easier. You can recompile all invalid objects,search for text in database sources, import and export tables, monitor dbms_alert and dbms_pipe events, view sessioninformation, and so on.

    PL/SQL Developer provides a powerful search function to find specific text in database sources. You can perform a casesensitive search, use regular expressions, search for whole words only and limit the object types to search in. From theobject list you can immediately view, edit, recomplile or drop the object.The actual search is performed in the background, so that you can continue doing other work while the search is running.Search progress is indicated at the bottom of the form.

    During development you will often make changes that invalidate related objects. To determine which objects are invalidand to recompile these objects, you can use the 'Compile Invalid Objects' function. After recompilation you can quicklydetermine which objects are still invalid and what compilation errors they have. From the object list you can immediatelyview, edit, recomplile or drop the object.

    Plug-In extensions

  • 7/23/2019 PL-SQL 2015-Programin

    19/20

    The functionality of PL/SQL Developer can be extended through Plug-Ins. We supply Plug-Ins on theAdd-onspage thatyou can download without any extra costs. Plug-Ins can be provided by Allround Automations (such as the VersionControl Plug-Inor the plsqldoc Plug-In) or by other users. If you have a programming language that can create DLL's, youcan even write your own Plug-Ins.

    The Version Control Plug-Inprovides a tight integration between the PL/SQL Developer IDE and any Version ControlSystem that supports the Microsoft SCC Interface Specification. This includes most popular Version Control Systemssuch as Microsoft Visual SourceSafe, Merant PVCS and MKS Source Integrity. The Plug-In offers the following benefits:

    Improve productivity- You can quickly perform any VCS operation on the currently opened file in the PL/SQLDeveloper IDE, like check out, check in, get, add, view differences, and so on. Operations on multiple files willimmediately be reflected in PL/SQL Developer's IDE.

    Minimize errors- Because you can work from one single IDE, the chance is minimized that you operate on thewrong file or that you forget a file

    When the VCS Plug-In is installed, you will get a new VCS item in the main menu that contains all relevant VCS functions.In addition to this, the Program Window, SQL Window,Test Window and Command Window get several new VCS relateditems in theircontext menu. You can check in, check out, undo check out, get, add and remove the corresponding file, i fappropriate.

  • 7/23/2019 PL-SQL 2015-Programin

    20/20

    This Plug-In allowsyou to generate HTML documentation for functions, procedures, packages, types, tables and views.The documentation is derived from the definition and the comments of these objects, in a similar way as Javadocfor theJava programming language.The Plug-In also allows you to quickly view object documentation from within the PL/SQL Developer IDE, by simplyclicking on an object name in a SQL or PL/SQL source file, or from within the Object Browser. A global documentationindex and the hyperlinks within each HTML document provide easy navigation. The Plug-In offers the following benefits:

    Increased documentation quality- You no longer need to create and maintain separate documentation foryour database objects, but merely need to write the appropriate comments within each object. Thedocumentation generation is effortless, and this ensures that the documentation is always in sync with the latestdevelopments. It also ensures a consistent layout of all documentation.

    Increased productivity- The user of the documentation can easily find a document and related documents,

    thanks to the tight integration with the PL/SQL Developer IDE and the hyperlinks. The author of thedocumentation benefits from the generation process.

    When the plsqldoc Plug-In is installed, you will get a new plsdoc item in the Tools menu that contains all plsqldocfunctions to generate and view documentation. These functions are also available in various popup menus and the maintoolbar.

    Multi-threaded IDEPL/SQL Developer is a multi-threaded IDE. This means that you can continue to work as SQL queries are executing,PL/SQL programs are executing, debug sessions are running, and so on. It also means that the IDE will not "hang" if youmake a programming error: you can break execution or save your work at any time.

    Easy installation

    No middle-ware required other than SQL*Net. No database object installation. Just a simple one-button installationprocedure and you're ready to use it.

    System requirements PL/SQL Developer will run on Windows 95, 98, ME, NT4, 2000 and XP. The supported Oracle Server versions

    are 7.x, 8.x, 8i and 9i on any platform. To connect to an Oracle database, PL/SQL Developer requires a 32-bitSQL*Net or Net 8 or Net 9 version. Trial version You can download a fully functional 30-day trial version to tryout PL/SQL Developer yourself. If after 30 days you can't imagine how you've ever been able to work withoutPL/SQL Developer.