Creating a Function
CREATE [OR REPLACE] FUNCTION function_name
[(parameter_name [IN | OUT | IN OUT] type [, ...])]
RETURN return_datatype
{IS | AS}
BEGIN
< function_body >
END [function_name];
Where,
function-namespecifies the name of the function.[OR REPLACE]the option allows the modification of an existing function.- The optional parameter list contains the name, model, and types of the parameters. IN represents the value that will be passed from outside and OUT represents the parameter that will be used to return a value outside of the procedure.
- The function must contain a return statement.
- The
RETURNclause specifies the data type you are going to return from the function. function-bodycontains the executable part.- The
ASkeyword is used instead of theISkeyword for creating a standalone function.
Drop Function
DROP FUNCTION function_name;