Declaring a Scalar User-Defined Function in Sybase Central

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.

  1. In Sybase Central, connect to the database as a user with DBA or Resource authority.
  2. In the left pane, right-click Procedures & Functions and select New > Function.
  3. In the Welcome dialog, type a name for the function and select the user to be the owner of the function.
  4. To create a user-defined function, select External C/C++. Click Next.
  5. In the External Function Attributes dialog, select Scalar.
  6. Type the name of the dynamically linkable library file, omitting the .so or .dll extension.
  7. Type a name for the descriptor function. Click Next.
  8. Select the type of value to be returned in the function, and specify the size, units, and scale for the value. Click Next.
  9. Select whether or not the function is deterministic.
  10. Specify if the function respects or ignores NULL values.
  11. Select whether the privileges used for running the function are from the defining user (definer) or the calling user (invoker).
  12. Add a comment describing the purpose of the new function. Click Finish.
  13. In the right pane, click the SQL tab to complete the procedure code.