A function in PL/SQL is a named code block that returns a value, similar to a procedure but with a mandatory return. Functions have three sections - a declaration section for variables, an executable section containing code to perform a task, and an optional exception handling section. The CREATE FUNCTION syntax identifies the function name, any parameters, the return data type, and the three sections within the BEGIN and END keywords. An example creates a factorial function that returns the factorial of a number passed as a parameter.