Creating a Stored Procedure or Function

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

  • 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 Model > Procedures to access the List of Procedures, and click the Add a Row tool.

  • Right-click the model or package in the Browser, and select New > Procedure.

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.

  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 Definition tab:


  5. [optional] Select a procedure template from the Template list (see Procedure Templates (PDM)).
  6. Modify the procedure definition 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.
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 definition is added to the Generated SQL Files list in the Workspace Navigator.