Collection Contents Index Miscellaneous functions Alphabetic list of functions pdf/chap8.pdf

Reference Manual
   CHAPTER 8. SQL Functions     

Java and SQL user-defined functions


There are two mechanisms for creating user-defined functions in Adaptive Server Anywhere. You can use the SQL language to write the function, or you can use Java.

User-defined functions in SQL 

You can implement your own functions in SQL using the CREATE FUNCTION statement. The RETURN statement inside the CREATE FUNCTION statement determines the data type of the function.

Once a SQL user-defined function is created, it can be used anywhere a built-in function of the same data type is used.

For Info     For more information on creating SQL functions, see Using Procedures, Triggers, and Batches.

User-defined functions in Java 

Although SQL functions are useful, Java classes provide a more powerful and flexible way of implementing user-defined functions, with the additional advantage that they can be moved from the database server to a client application if desired.

Any class method of an installed Java class can be used as a user-defined function anywhere a built-in function of the same data type is used.

Instance methods are tied to particular instances of a class, and so have different behavior to the standard idea of user-defined functions.

For Info     For more information on creating Java classes, and on class methods, see A Java seminar.


Collection Contents Index Miscellaneous functions Alphabetic list of functions pdf/chap8.pdf