Invoking a stored procedure


Use the following procedure to call a native or external stored procedure and view the results.

The Scratchpad perspective displays the called procedure. The Procedure tab displays the CREATE statement for the stored procedure in view-only mode. Use the Alter editor to update native stored procedures. For more information, see Updating-a-stored-procedure.

NW_Scratchpad_Call_SPE2404.png

To invoke a stored procedure

  1. In the DB2 Navigator perspective, select the required stored procedure.For more information, see Navigating-to-an-object.
  2. Select the CALL command from the Commands list.The Scratchpad perspective displays the Parameters dialog box. 
  3. In the Parameters dialog box, complete the following fields and click OK:

    Field

    Description

    DB2 Connection

    Select the Db2 subsystem where you want to run the stored procedure.

    Commit

    Select Commit or Rollback.

    Parameters Profile

    Select a saved set of values to use as Input parameters.

    Input parameters

    Enter data for each of the parameters listed.

    Save

    To save the Input parameters as a profile, click Save, enter a name for the profile, and click OK.

    The Output tab displays a summary of the stored procedure.

  4. To view results, perform one of the following actions:
    • To view all results, click View All Result Sets  NW_table.png.
    • To view a specific result set, on the Output tab, click the relevant View result set.
  5. To save the output in a text file on your local file system, perform the following actions:
    1. On the toolbar, click View output text NW_file_text_o.png.
    2. In the Output Text dialog box, click Save output text NW_floppy.png.
  6. To invoke the procedure again, perform the following actions:
    1. Click the Procedure tab.
    2. Click CALL  NW_CALL_procedure.png.
      The Parameters dialog box is displayed. Return to step 3.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*