User Defined Scalar Function are a type of FairCom DB SQL expression that return a value based on the argument(s) supplied. User Defined Scalar Functions are invoked in exactly the same manner as built in scalar functions.
User Defined Scalar Functions can be used in the SELECT list or in the WHERE clause. They can be used as parameters of other scalar functions or included with other SQL expressions. The parameter passed to a user defined scalar function can be a literal, field reference or any expression
Example with Constants
SELECT str_cat('abcd','efgh') FROM syscalctable;
STR_CAT(ABCD,EFGH)
-------------------------------
abcdefgh
1 record selected
Example with Constants and Column References
SELECT empfname, str_cat(empfname, emplname) FROM emp WHERE str_cat('mary', 'john') = 'maryjohn';
EMPFNAME STR_CAT(EMPFNAME,EMPLNAME)
---------------- ---------------------------------------------
Mary MaryJohn
1 records selected
Example with Parameter References
SELECT str_cat(?, ?) FROM emp
SELECT * FROM emp WHERE str_cat(?, ?) = 'MaryJohn'