CREATE FUNCTION statement
446
EXTERNAL NAME clause A function using the EXTERNAL NAME
clause is a wrapper around a call to a function in an external library.
A function using EXTERNAL NAME can have no other clauses following
the RETURNS clause.
$ For information about external library calls, see "Calling external
libraries from procedures" on page 488 of the book ASA User’s Guide.
EXTERNAL NAME LANGUAGE JAVA clause A function that uses
EXTERNAL NAME with a LANGUAGE JAVA clause is a wrapper around
a Java method.
$ For information on calling Java procedures, see "CREATE
PROCEDURE statement" on page 453.
ON EXCEPTION RESUME clause Use Transact-SQL -like error
handling. For more information, see "CREATE PROCEDURE statement" on
page 453.
♦
SQL/92 Persistent Stored Module feature.
♦
Sybase Not supported by Adaptive Server Enterprise.
♦ The following function concatenates a
firstname
string and a
lastname
string.
CREATE FUNCTION fullname (
firstname CHAR(30),
lastname CHAR(30) )
RETURNS CHAR(61)
BEGIN
DECLARE name CHAR(61);
SET name = firstname || ’ ’ || lastname;
RETURN (name);
END
The following examples illustrate the use of the fullname function.
♦ Return a full name from two supplied strings:
SELECT fullname (’joe’,’smith’)
fullname(’joe’, ’smith’)
joe smith
♦ List the names of all employees:
SELECT fullname (emp_fname, emp_lname)
FROM employee
Standards and
compatibility
Example