![Free-eBooks.net](/resources/img/logo-nfe.png)
![All New Design](/resources/img/allnew.png)
19-HOW TO CREATE FUNCTION
Functions are forming part of set commands' Functions can return
a value to the caller' Functions can be referred directly in the SQL queries' The value is returned through keyword within the function' Let us analyze the function syntax
create or replace function << function-name >>
( <<out-variable-name>> IN <<variable-data-type>> )
return <<data-type>>
<<variable-name>> <<data-type and length>>;
begin
' ' ' ' '
' ' ' ' '
RETURN (<<out-variable-name>>); ExCEPTION
WHEN NO-DATA-FOUND THEN
RAISE-APPLICATION-ERROR(-20100,
'some error messages');
end;
Now, we will write a complex function and learn some of the newer concepts of sql and concepts of function'