You create database package procedures on the Procedures tab of a database package using the Add a Row tool. To copy a procedure from elsewhere in the model, use the Create from Procedure tool.
In addition to the standard Name, Code, Comment, and Stereotype, a database package procedure has the following properties:
Property |
Description |
---|---|
DB Package |
Name of the database package to which the procedure belongs. |
Type |
Allows you to choose between procedure and function. |
Return data type |
Allows you to define the return data type of a function. |
Pragma |
Allows you to type a compiler directive, that is, a string for specifying compilation parameters for the procedure. |
Public |
Allows you to declare the procedure in the package specification and to permit use from outside the database package. A private procedure (check box deselected) is only defined in the package body. |
Parameters – Lists the input and output parameters required by the procedure (see Database Package Parameters).
Definition tab - Lets you define package procedures. Package procedures are not built using the structure of templates defined in the DBMS. You have to type the entire package procedure definition. To do so, you can use operators and functions to insert script items into the cursor definition.
For example, the definition of the CREDIT package procedure is the following:
CREATE PROCEDURE credit (Account_number NUMBER, Amount IN NUMBER) AS BEGIN UPDATE accounts SET balance = balance + amount WHERE account_id = acc_no; END;