If you want to return a null function in Python then use the None keyword in the returns statement.
Functions can return VOID if there is no useful data to return, as in a SQL DELETE , INSERT , or UPDATE statement.
A void function can returnA void function cannot return any values. But we can use the return statement. It indicates that the function is terminated. It increases the readability of code.
If we get to the end of any function and we have not explicitly executed any return statement, Python automatically returns the value None. Some functions exists purely to perform actions rather than to calculate and return a result. Such functions are called procedures.
Use RETURNS void
like below:
CREATE FUNCTION stamp_user(id int, comment text) RETURNS void AS $$
#variable_conflict use_variable
DECLARE
curtime timestamp := now();
BEGIN
UPDATE users SET last_modified = curtime, comment = comment
WHERE users.id = id;
END;
$$ LANGUAGE plpgsql;
Functions must always return something, although you can use procedures like
do $$
and start with normal function like
declare
...
but if you still want to do a function just add void after returns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With