Creating an ASE User-Defined Function

Create a user-defined function in ASE.

Prerequisites 

Be sure the data server that contains the user-defined function is running, and that you have created and established a connection to the data server.

  1. In Enterprise Explorer, right-click the User Defined Functions folder, and select New > User Defined Function .
  2. (Optional) Change the Owner.
  3. Enter the Function Name.
  4. Enter the return data Name and select its datatype.
  5. Select With Recompile to indicate that a new plan is created each time the function is first referenced in a SQL statement.

    Use this option if you expect an atypical execution of the function that requires a new plan.

  6. (Optional) Enter a description in the Comments field.
  7. (Optional) Click Next to indicate parameters or variables, and their corresponding datatypes.

    The parameter's default value is optional.

  8. Indicate the execution and save options.
    Option Description
    Generate Script Generate a SQL file for the object.
    Enter or Select the Parent Folder Specify an existing project or create a new project in which to store the SQL file.
    File Name Enter the file name in which to save the SQL code.
    Execute Immediately Execute the SQL code immediately. If you do not select this option, you must execute the SQL script later to create the user-defined function.
    Open in Editor After Creation Create the object and open it in its associated editor.
  9. Click Finish to create the user-defined function.


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com