Sybase IQ supports simple scalar UDFs that can be used anywhere
the SQRT function can be used. These scalar UDFs can be deterministic,
which means that for a given set of argument values, the function
always returns the same result value. Sybase IQ also supports nondeterministic
scalar functions, which means that the same arguments can return
different results.
-
In Sybase Central, connect to the database as a user with
DBA or Resource authority.
-
In the left pane, right-click Procedures &
Functions and select New > Function.
-
In the Welcome dialog, type a name for the function
and select the user to be the owner of the function.
-
To create a user-defined function, select External
C/C++. Click Next.
-
In the External Function Attributes dialog, select
Scalar.
-
Type the name of the dynamically linkable library file, omitting
the .so or .dll extension.
-
Type a name for the descriptor function. Click
Next.
-
Select the type of value to be returned in the
function, and specify the size, units, and scale for the value.
Click Next.
-
Select whether or not the function is deterministic.
-
Specify if the function respects or ignores NULL
values.
-
Select whether the privileges used for running
the function are from the defining user (definer) or the calling
user (invoker).
-
Add a comment describing the purpose of the new
function. Click Finish.
-
In the right pane, click the SQL tab to complete
the procedure code.