IBM Database Add-Ins for Visual Studio  

Running Procedures or Functions

You can run IBM® database procedures or functions for testing purposes. When you run a procedure or function, you can determine whether the test run is successful and whether the result set exists. Running a procedure or function also helps you to test the logic of the routine and the accuracy of output arguments and result sets.

For a DB2 database
If you define package variations for an SQL procedure that you run on a DB2® for z/OS® server, you can specify which package to use when you run the SQL procedure. This function is supported for DB2 for z/OS Version 9.1 or later.

You can also run versions of z/OS native SQL procedures in the same way that you run procedures. This function is supported for DB2 for z/OS Version 9.1 or later.

For an IDS database Running overloaded procedures that are based on data type produces undefined results.

To run a procedure or function:

  1. In the Server Explorer under your data connection, right-click the procedure or function that you want to run, and then click Run.

    The Run Options window opens.

  2. For a DB2 database for z/OS: In the Collection ID list, select the collection ID for the package variation that you want to run.
  3. If you want to commit the procedure or function to the database after execution, expand the Commit after execution section and then select True in the list.
  4. If you want to run a script before or after you run the routine, expand the Pre-run script or Post-run script section and then enter the code for the script.
  5. If the procedure or function requires input parameters, for each input parameter, do the following steps in the Parameters List section:
    1. Select Null only if you want to specify a NULL value for the parameter.
    2. Specify a value for the parameter. If your data source is DB2 for Linux, Unix, and Windows, version 9.7 or higher, you can use the default value.
      • To specify a value for the parameter, click the Value cell for the parameter, and then specify the value that you want to use when the procedure or function runs.

        If the data type of a parameter is CLOB, when you click its Value cell, the Ellipsis button button is displayed. Either type a value in the cell or click the button and select a file to use as the parameter value for the CLOB.

        For a DB2 database For an IDS database If the data type of a parameter is BLOB, when you click its Value cell, the Ellipsis button button is displayed. Either type a value in the cell or click the button and select a file to use as the parameter value for the BLOB.

        For a DB2 database If the data type of a parameter is XML, when you click its Value cell, the Ellipsis button button is displayed. Click the button, and then in the Open window, select the file whose content provides the XML value for the parameter.

        For a DB2 database Version 9.7 for Linux®, UNIX®, and Windows®, or later: If a parameter is an array data type, when you click its Value cell, the Ellipsis button button is displayed. Click the button, and then in the Specify Array Values window, enter values for the array.

      • To use the default value for the parameter, select Default Value. If you entered a value for a parameter in the Value field, both the NULL and the Default Value check boxes become unselected. You can reselect either check box if necessary.
  6. Click Run.

    A run task message and a status message are displayed in the Output View. Result sets are displayed in the IBM Data Designer.

    Some screen readers have problems reading values in the results grid. The Microsoft® Inspect Object screen reader is slow recognizing the cell information. The screen reader JAWS® for Windows does not read the data in the first cell of the last row in the grid.

  7. To filter the results, expand the Options section of the designer, specify your filter options, and then click Refresh.

    For detailed information about each of the filter options, see Data, Designer.

  8. For a DB2 database Optional: If the results contain XML data that you transformed in the Options section, review the transformed XML data in the HTML Visualizer window. Click a cell that contains XML data, click Ellipsis button, and then click HTML Visualizer on the drop-down menu.

After you have run the procedure or function and filtered the result data, you can export the data that is displayed in the designer.


See Also

Managing Procedures, Functions, and Objects | Run Options | Exporting Result Data from Procedures and Functions | Transforming XML Data | HTML Visualizer | Array Parameters in DB2 SQL Procedures


.NET Development Forum   DB2 FAQs   IDS FAQs

© Copyright IBM Corporation 2002, 2018. All Rights Reserved.