Show TOC

Creating a Stored Procedure or FunctionLocate this document in the navigation structure

You can create a stored procedure or function from a table property sheet or from the Toolbox, Browser, or Model menu.

Context

  • Use the Procedure tool in the diagram Toolbox.

  • Open the Procedures tab in the property sheet of a table, and click the Add a Row tool.

  • Select Start of the navigation path Model Next navigation step Procedures End of the navigation path to access the List of Procedures, and click the Add a Row tool.

  • Right-click the model or package in the Browser, and select Start of the navigation path New Next navigation step Procedure End of the navigation path.

For general information about creating objects, see Core Features Guide > Modeling with PowerDesigner > Objects.

You can create a procedure based on one of the PowerDesigner templates or on a template of your own.

Procedure

  1. Double-click a table symbol to open its property sheet, and then click the Procedures tab.
  2. Click the Add a Row tool to create a new procedure, and type a name and code.
  3. Click Apply to commit the creation of the new procedure, and then click the Properties tool to open its property sheet.
  4. Click the Body tab:


  5. [optional] Select a procedure template from the Template list (see Procedure Templates (PDM)).
  6. Modify the procedure code. You can use PDM variables and macros and various other tools available from the toolbar (see Writing SQL Code in PowerDesigner).
  7. You can also modify the procedure's other properties. For a full list of the properties available, see Procedure Properties.
  8. Click OK in each of the dialog boxes.

Results

Note

When using the PowerDesigner Eclipse plug-in, you can right-click a procedure in the Browser or diagram and select Edit in SQL Editor from the contextual menu to open it in the Eclipse SQL Editor. You can optionally connect to your database in order to obtain auto-completion for table names. The procedure is added to the Generated SQL Files list in the Workspace Navigator.