Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not returning anything from postgresql function?

Is it possible for a PostgreSQL plpgsql function to not return anything? I've created a function, and I don't need it to return anything at all, as it performs a complex SQL query, and inserts the results of that query into another table (SELECT INTO ....). Thus, I have no need or interest in having the function return any output or value. Unfortunately, when I try to omit the RETURN clause of the function declaration, I can't create the function. Is it possible for a PostgreSQL plpgsql function to not return anything?

like image 499
netllama Avatar asked May 01 '10 03:05

netllama


1 Answers

Yes - "If the function is not supposed to return a value, specify void as the return type." and also - "If you declared the function to return void, a RETURN statement can be used to exit the function early; but do not write an expression following RETURN.".

like image 162
Milen A. Radev Avatar answered Oct 07 '22 14:10

Milen A. Radev