A procedure is a subprogram that performs a specific action. You can use Object Browser to view, create, edit, download, and drop procedures.
Topics:
See Also: SQL*Plus User's Guide and Reference for information about PL/SQL procedures |
To create a procedure:
Navigate to Object Browser:
Click the SQL Workshop icon on the Workspace home page.
Click Object Browser.
Object Browser appears.
Click Create.
From the list of object types, select Procedures.
Enter a procedure name and click Next.
Define the arguments by specifying the following information (optional):
Argument Name
In/Out (the parameter mode)
Argument Type (datatype)
Default (value)
To add additional arguments, click Add Argument.
Click Next.
Enter PL/SQL block you want to use as the procedure body and click Next.
To view the previously defined arguments, click Defined Arguments.
A confirmation page appears. To view the SQL used to create the procedure, click Show SQL.
Click Finish.
To browse a procedure:
Navigate to Object Browser:
Click the SQL Workshop icon on the Workspace home page.
Click Object Browser.
Object Browser appears.
From the Object list, select Procedures.
From the Object Selection pane, select a procedure.
The Code view appears, displaying the source code for the procedure. You can copy the code in this view for use in other tools.
Click the tabs at the top of the page to view different reports about the procedure. Table 18-8 describes all available views.
Table 18-8 Available Views for Procedures
View | Description |
---|---|
Code |
(Default) Displays the source code for the procedure. You can copy the code in this view for use in other tools. Actions you can perform in this view include:
See Also: "Editing a Procedure", "Compiling a Procedure", "Downloading a Procedure", and "Dropping a Procedure" |
Dependencies |
Displays objects that use (or depend) on the current procedure and objects the procedure depends on. |
Errors |
Lists errors related to the current procedure. |
Grants |
Lists details of grants for the current procedure, including privilege, grantee, grantable, grantor, and object name. |
When you edit a procedure you can edit the code manually or perform a search and replace.
To edit a procedure manually:
Navigate to Object Browser:
Click the SQL Workshop icon on the Workspace home page.
Click Object Browser.
Object Browser appears.
From the Object list, select Procedures.
From the Object Selection pane, select a procedure.
The Code view appears. Be default, you can copy the code in this view for use in other tools.
Click Edit to activate edit mode.
Click Find to perform a basic search and replace.
Note: You can expand the Edit pane by clicking the Full Screen icon in the upper right of the pane, beneath the Create button. |
If you edit and make changes to a procedure, you need to compile in order to save your changes. There is no save function because this is just a view of the object within the database.
Click Compile to compile the current procedure. Compiling re-creates the object in the database. If the compile fails, an error message display above the code.