January 2019
Beginner
556 pages
14h 19m
English
The PostgreSQL return statement is used for terminating the function and for returning the control to the caller. The return statement has different forms, such as RETURN, RETURN NEXT, RETURN QUERY, and RETURN QUERY EXECUTE. The RETURN statement can return a single value or a set to the caller, as we will show in this chapter. In this context, let's consider the following anonymous function:
DO $$BEGIN RETURN; RAISE NOTICE 'This statement will not be executed';END$$LANGUAGE plpgsql;--- output DO
As shown in the preceding example, the function is terminated before the execution of the RAISE statement, due to the RETURN statement.
Read now
Unlock full access