Plan the routine

When you write a UDR, consider the following:
  • Naming your routine
  • Defining routine parameters
  • Defining a return value (user-defined functions only)
  • Adhering to coding standards

The routine name and routine parameters make up the routine signature for the routine. The routine signature uniquely identifies the UDR in the database. For more information, see The routine signature.

Consider the following questions about routine naming and design:
  • Are any of my routines modal? That is, does the behavior of the routine depend on one of its arguments?
  • Can I describe what each type and routine does in two sentences?
  • Do any of my routines take more than three arguments?
  • Have I used polymorphism effectively?

If you plan to enable the implicit or explicit execution of a UDR across databases, all user-defined data types and casts must be defined in all of the participating databases of the same database server instance.