Use Database Development tools to create your own functions for SQL Anywhere or Sybase IQ.
Prerequisites Before you can create a user-defined function, be sure the data server that contains the user-defined function is
running, and you created and established a connection to the data
server.
- Right-click the
User Defined Functions folder, and choose
.
The
Create Function Skeleton page appears.
-
In the
Name field, enter the new function name.
- Specify the SQL type you are using.
SQL Type |
Description |
Watcom-SQL |
You can then choose either
Deterministic function or
On exception resume.
A deterministic function only works with Watcom-SQL. A function specified as not deterministic is re-evaluated each time it is called in a query.
|
Transact-SQL |
You can only select
On exception resume.
The On Exception Resume clause enables Transact SQL-like error handling to be used within a Watcom SQL syntax procedure.
|
-
Enter a name in the
Return Data field, and select the appropriate datatype from the drop-down.
-
(Optional) Enter a description of the function in the
Comments field and click
Next.
The
Provide Optional Parameters and Variables Declaration page appears.
-
Enter a parameter name in the
Name column.
-
Click the
Datatype column to select a datatype from the drop-down.
-
Specify any optional default value for the parameter you are defining.
-
Declare variables, or click
Finish if you have no variables to declare.
-
In the
Name column, enter any local variable names that you want to declare.
-
Click the
Datatype column to select a datatype from the drop-down list.
- Click
Next, and specify save and execution
properties for the user-defined function.
Field |
Description |
Generate script |
Select this option to generate the script for the user-defined function. |
Enter or select the parent folder |
Specify an existing project or create a new project in
which to save the SQL. |
File name |
Enter the name of the file in which to store the
SQL. |
Execute immediately |
Execute the SQL immediately. If you do not select this
option, you must complete execution of the SQL later to create the user-defined function. |
Open in editor after creation |
Create the user-defined function, and then open it in the User Defined Function Editor. |
- Click
Finish to create the user-defined function.
The newly created user-defined function
is opened automatically in the User-Defined Function Editor.
Send your feedback on this help topic to Sybase Technical Publications:
pubs@sybase.com
Your comments will be sent to the technical publications staff at Sybase, Inc.
For product-related issues or technical support, contact Sybase Technical Support
at 1-800-8SYBASE.