Importing Stored Procedures


Often, an SQL procedure that you want to work with has already been written by someone else or exists in another project. The Development Center allows you to quickly create a new procedure from code that is saved elsewhere.

Once you have opened up a project, you can import a procedure by right-clicking on the Stored Procedure folder icon and selecting Import, as illustrated in Figure D.28.

Figure D.28. Importing a stored procedure.


There are two sources from which a procedure can be imported: The procedure can be directly extracted from a database, or it can be read in from a file. The database import option allows you to use filters to limit the search for procedures that may exist in a database. The file system option will allow you to either import a procedure from a file or from another project. These two options are shown in Figure D.29.

Figure D.29. Import from a file or another database.


All SQL procedures used in this book are included in files on the book's CD, and are named based on chapter and figure numbers. When you import a procedure, a number of options are available that allow you to alter the properties and specifics of the procedure. These options should not be altered when you initially work with the sample procedures, but you are free to experiment with them as you become more comfortable with DB2 and SQL PL.

Another convenient way to import database application objects directly from a database is through the Server View in the Development Center. If your Server View is not open, open it from the View menu. In the Server View, you will see the procedures that currently exist on the database. Right-click on any object and select Add to Project (see Figure D.30).

Figure D.30. Adding procedures to your project from the Server View.


TIP

If you want to add multiple objects to your project, use the Import feature from the Project View. If you want to quickly add only one or few objects, using Add to Project from the Server View is faster.




    DB2 SQL PL. Deployment and Advanced Configuration Essential Guide for DB2 UDB on Linux., UNIX, Windows, i5. OS, z. OS
    Intelligent Enterprises of the 21st Century
    ISBN: N/A
    EAN: 2147483647
    Year: 2003
    Pages: 205

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net