Managing Functions
A function is a subprogram that can take parameters and return a single value. You can use Object Browser to create, view, edit, compile, download, and drop functions.
See Also:Oracle AI Database SQL Language Reference for information about PL/SQL functions Oracle AI Database PL/SQL Language Reference
Creating a Function
Create a function using Object Browser.
To create a function:
-
In Object Browser, click the Create Database Objects menu and select Function.
Tip:
To create new objects from the Object Tree, right-click the object and select the Create option.
The Create Function Wizard appears.
-
On Create Function:
-
Name - Enter the name of the function. This name must conform to Oracle naming conventions and cannot contain spaces or start with a number or underscore.
-
Include Sample Code - Specify whether to include sample code.
-
-
Click Create Function.
Viewing a Function
Select a function from the Object Tree and access tabs in the Object Detail View.
To view a function:
-
In Object Browser, Object Tree, expand Functions and select a function.
-
The Object Detail View appears and displays four tabs:
-
Code - View the source code for the function, or edit it manually. Available actions include:
-
Download
-
Save and Compile
-
Drop
-
Refresh
-
-
Dependencies - View objects that use (or depend) on the current function and objects that the function depends on. Select the Refresh button to refresh the list of functions.
-
Errors - View the errors related to the current function. Select the Refresh button to refresh the list of functions.
-
Grants - View the details of grants for the current function. Available buttons include:
-
Grant
-
Revoke
-
Refresh
-
-
Editing a Function
Select a trigger from the Object Tree.
-
In Object Browser, Object Tree, expand Functions and select a trigger.
The Object Detail View appears.
-
In the Code tab, edit the code. Other edit controls include:
-
Undo
-
Redo
-
Find
-
Auto Complete
Tip:
To learn more about the Code Editor, seeCode Editor in Object Browser.
-
Compiling a Function
Select a function from the Object Tree and click Save and Compile.
If you edit and make changes to a function, you must compile to save your changes. Compiling re-creates the function in the database.
To compile a function in Object Browser:
-
In Object Browser, Object Tree, expand Functions and select a function.
The Object Detail View appears.
-
On the Code tab, click Save and Compile.
If the compilation fails, an error message displays. Correct the error and compile the function again.
Downloading a Function
Select a function from the Object Tree and click Download to save the function.
To download a function:
-
In Object Browser, Object Tree, expand Functions and select a function.
The Object Details View appears.
-
On the Code tab, click Download.
-
Enter a file name for the file and click Save.
The file saves in
.sqlformat.
Dropping a Function
Select a function from the Object Tree and click Drop.
To drop a function in Object Browser:
-
In Object Browser, Object Tree, expand Functions and select a function.
The Object Details View appears.
-
On the Code tab, click Drop.
-
Drop - Review the details.
-
SQL - Displays the SQL generated to drop the function. To copy the displayed SQL, click the Copy icon.
-
To confirm your selection, click Drop again.
-
-
To confirm, click Drop.